Created
December 6, 2023 18:23
-
-
Save Ogaday/86b23c378e5acfbbad7fea3e17bc3452 to your computer and use it in GitHub Desktop.
Clickhouse - merge with nulls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Outer Merges with Nulls in ClickHouse | |
* | |
* By default, outer merges in clickhouse will produce _interesting_ defualt | |
* values for empty cells in an outer join. This query demonstrates how to | |
* configure clickhouse to use nulls for missing values, as in the SQL | |
* standard. | |
* | |
* See: https://clickhouse.com/docs/en/operations/settings/settings#join_use_nulls | |
* | |
*/ | |
SELECT | |
* | |
FROM left | |
FULL OUTER JOIN right | |
ON left.key = right.key | |
ORDER BY COALESE(left.value, right.value) | |
SETTINGS join_use_nulls=1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment