osipovartem commented on code in PR #24972:
URL: https://github.com/apache/datafusion/pull/24972#discussion_r3987079864


##########
datafusion/sqllogictest/test_files/subquery_projection.slt:
##########
@@ -0,0 +1,57 @@
+# IN subqueries in projection use SQL three-valued logic.
+
+query BB
+WITH empty AS (SELECT 10 WHERE false)
+SELECT
+    NULL IN (SELECT * FROM empty),
+    NULL NOT IN (SELECT * FROM empty)
+FROM (SELECT 1) t;
+----
+false true
+
+query B
+SELECT 'a' IN (SELECT column1 FROM VALUES ('b'), ('c'), ('d'));
+----
+false
+
+query BBBB
+WITH vals AS (SELECT * FROM (VALUES (1), (2), (NULL)) AS t(x))
+SELECT
+    1 IN (SELECT x FROM vals) AS found,
+    3 IN (SELECT x FROM vals) AS unknown,
+    3 NOT IN (SELECT x FROM vals) AS not_unknown,
+    NULL IN (SELECT x FROM vals) AS null_unknown;
+----
+true NULL NULL NULL
+
+query BB
+WITH vals AS (SELECT * FROM (VALUES (1), (2)) AS t(x))
+SELECT
+    EXISTS (SELECT x FROM vals WHERE x = 2),
+    NOT EXISTS (SELECT x FROM vals WHERE x = 3);
+----
+true true
+
+# Correlated IN distinguishes a match, a miss, a NULL-containing result,
+# and an empty result independently for each outer row.

Review Comment:
   Added correlated NOT IN execution coverage for all requested cases: an inner 
NULL, an empty correlated result, and a NULL outer value, along with match and 
miss controls. The focused subquery_projection SLT passes locally.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to