comphead commented on code in PR #13680:
URL: https://github.com/apache/datafusion/pull/13680#discussion_r1899184661


##########
datafusion/sqllogictest/test_files/sort_merge_join.slt:
##########
@@ -647,6 +647,54 @@ NULL NULL 7 9
 NULL NULL 8 10
 NULL NULL 9 11
 
+query II
+select * from (
+with
+t1 as (
+    select 31 a, 32 b union all
+    select 31 a, 33 b
+),
+t2 as (
+    select 31 a, 32 b union all
+    select 31 a, 35 b
+)
+select t2.* from t1 right anti join t2 on t1.a = t2.a and t1.b = t2.b
+) order by 1, 2;
+----
+31 35
+
+query II
+select * from (
+with
+t1 as (
+    select 41 a, 42 b union all
+    select 41 a, 43 b
+),
+t2 as (
+    select 41 a, 42 b union all
+    select 41 a, 45 b
+)
+select t2.* from t1 right anti join t2 on t1.a = t2.a and t1.b = t2.b

Review Comment:
   interesting thing: right ANTI/SEMI naturally not supported by SQL text, 
however DF supports it, DuckDB/PG will fail on query like that because of parse 
error.
   
   DF runs it and picks the join type properly 
   
   ```
   | plan_type     | plan                                                       
                                 |
   
+---------------+---------------------------------------------------------------------------------------------+
   | logical_plan  | Sort: t2.a ASC NULLS LAST, t2.b ASC NULLS LAST             
                                 |
   |               |   RightAnti Join: t1.a = t2.a, t1.b = t2.b                 
                                 |
   
   ```
   
   From one side it is really convenient to test out queries with RIGHT 
ANTI/SEMI using SQL, from another it is not very expected behavior comparing to 
other engines.
   
   WDYT should we do something with that? @alamb @Dandandan @ozankabak 
@jayzhan-synnada @findepi 



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to