Fix logical error in ANTI join with NULL

This commit is contained in:
vdimir 2023-06-29 13:09:55 +00:00
parent 4b02d83999
commit f1d6954637
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
3 changed files with 25 additions and 0 deletions

View File

@ -1383,6 +1383,9 @@ NO_INLINE IColumn::Filter joinRightColumns(
{
if (!right_row_found && null_element_found)
{
if constexpr (join_features.is_anti_join && join_features.left)
setUsed<need_filter>(filter, i);
addNotFoundRow<join_features.add_missing, join_features.need_replication>(added_columns, current_offset);
if constexpr (join_features.need_replication)

View File

@ -11,7 +11,9 @@
0 0
0 0
0 1
\N 0
0 1
\N 0
0 0
0 0
0 \N
@ -25,7 +27,9 @@
0 0
0 0
0 2
\N 1
0 2
\N 1
0 \N
0 0
0 \N
@ -39,7 +43,9 @@
0 \N
0 \N
0 1
\N \N
0 1
\N \N
0 0
0 0
0 0
@ -53,7 +59,9 @@
0 0
0 0
\N 2
\N 1
\N 2
\N 1
0 0
0 0
0 0
@ -67,7 +75,9 @@
0 0
0 0
0 1
\N 0
0 1
\N 0
0 0
0 0
0 0
@ -81,7 +91,9 @@
0 0
0 0
1 2
\N 1
1 2
\N 1
0 \N
0 0
0 0
@ -95,7 +107,9 @@
0 \N
0 \N
0 1
\N \N
0 1
\N \N
0 0
0 0
0 0
@ -109,4 +123,6 @@
0 0
0 0
1 2
\N 1
1 2
\N 1

View File

@ -44,6 +44,12 @@ SELECT id > 1, d.idd FROM (SELECT {{ maybe_materialize }}(toLowCardinality(0)) A
ON a.id = d.idd
;
SELECT *
FROM (SELECT {{ maybe_materialize }}(NULL :: Nullable(UInt64)) AS id) AS a
{{ strictness }} {{ kind }} JOIN (SELECT {{ maybe_materialize }}(1 :: UInt32) AS id) AS d
ON a.id = d.id
;
{% endfor -%}
{% endfor -%}
{% endfor -%}