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
* Unit test showing incorrect `NULL IN ()` simplification
The optimization does not manifest as a bug in typical queries, because
the `ConstantEvaluator` prevents that. However, it still needs to be
corrected (or removed), otherwise it's a bug waiting to manifest
somewhere.
* Fix incorrect `NULL IN ()` optimization
Copy file name to clipboardExpand all lines: datafusion/sqllogictest/test_files/predicates.slt
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -811,5 +811,26 @@ explain select x from t where x NOT IN (1,2,3,4,5) AND x IN (1,2,3);
811
811
logical_plan EmptyRelation
812
812
physical_plan EmptyExec
813
813
814
+
query error DataFusion error: This feature is not implemented: Physical plan does not support logical expression InSubquery\(InSubquery \{ expr: Literal\(Int64\(NULL\), None\), subquery: <subquery>, negated: false \}\)
815
+
WITH empty AS (SELECT 10 WHERE false)
816
+
SELECT
817
+
NULL IN (SELECT * FROM empty), -- should be false, as the right side is empty relation
818
+
NULL NOT IN (SELECT * FROM empty) -- should be true, as the right side is empty relation
819
+
FROM (SELECT 1) t;
820
+
821
+
query I
822
+
WITH empty AS (SELECT 10 WHERE false)
823
+
SELECT * FROM (SELECT 1) t
824
+
WHERE NOT (NULL IN (SELECT * FROM empty)); -- all rows should be returned
825
+
----
826
+
1
827
+
828
+
query I
829
+
WITH empty AS (SELECT 10 WHERE false)
830
+
SELECT * FROM (SELECT 1) t
831
+
WHERE NULL NOT IN (SELECT * FROM empty); -- all rows should be returned
0 commit comments