You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want LEFT JOIN to honor Nullable types. In the current
implementation, a DEFAULT value is returned when there is no
corresponding record, but I want value2 to be NULL in the following
example:
DROP TABLE test1;
DROP TABLE test2;
CREATE TABLE test1 (day Date, key String, value1 Nullable(UInt32)) ENGINE=MergeTree(day, (key), 8192);
CREATE TABLE test2 (day Date, key String, value2 Nullable(UInt32)) ENGINE=MergeTree(day, (key), 8192);
INSERT INTO test1 VALUES ('0000-00-00', '1', NULL);
SELECT day, key, value1, value2 FROM test1 ANY LEFT JOIN test2 USING (key) FORMAT CSVWithNames;
:) SELECT day, key, value1, value2 FROM test1 ANY LEFT JOIN test2 USING (key) FORMAT CSVWithNames;
SELECT
day,
key,
value1,
value2
FROM test1
ANY LEFT JOIN test2 USING (key)
FORMAT CSVWithNames
"day","key","value1","value2"
"0000-00-00","1",NULL,0
1 rows in set. Elapsed: 0.004 sec.
Thank you for you note.
NULL functionality is unstable and not finalized yet (especially for JOIN clauses).
Finalized functionality will include proper JOIN implementation.
is join_use_nulls affect a function like emptyArrayToSingle ?
I'm using this to make left arrayJoin() that could be nice to have both LEFT ARRAY JOIN and arrayJoin linked by the same setting.
Activity
ludv1x commentedon Jan 18, 2017
Thank you for you note.
NULL functionality is unstable and not finalized yet (especially for JOIN clauses).
Finalized functionality will include proper JOIN implementation.
mxzwrnz commentedon May 22, 2017
Is there any news on that? Thanks a lot!
alexey-milovidov commentedon May 22, 2017
It is implemented.
Behaviour is controlled by
join_use_nullssetting.If set to 1, NULLs will be substituted instead of default values.
You could adjust this setting like any other - per query, per session, per user...
ramazanpolat commentedon Nov 27, 2019
If the RIGHT table have
Array(String)column, it is substituted with [], even ifjoin_use_nullsis set to 1.Is this expected behaviour?
As you can see the column
Xis[]while columnADisᴺᵁᴸᴸ.den-crane commentedon Nov 27, 2019
@ramazanpolat because for Arrays empty array [] is analog for Null. Arrays cannot be nullable itself but can contain nullable types.
crakjie commentedon Apr 17, 2020
is join_use_nulls affect a function like
emptyArrayToSingle?I'm using this to make left
arrayJoin()that could be nice to have bothLEFT ARRAY JOINandarrayJoinlinked by the same setting.4ertus2 commentedon Apr 17, 2020
You may try and make an issue if there's something unexpected.
crakjie commentedon Apr 20, 2020
@4ertus2 I tried and it seems
emptyArrayToSingleis not impacted byjoin_use_nulls. What is the expected behavior ?4ertus2 commentedon Apr 20, 2020
Let's make an issue. It could be something unknown or related to #9253