logan-keede commented on issue #123:
URL: https://github.com/apache/datafusion/issues/123#issuecomment-2646559348

   
   > In case anyone is curious -- we support correlated versions of these 
queries (via a join) but if there is no correlation (not super useful) we do not
   > 
   > ❯ create table foo as select * from (values (1), (2), (NULL)) as sql
   > ;
   > 0 rows in set. Query took 0.022 seconds.
   > 3 rows in set. Query took 0.007 seconds.
   > ❯ create table bar as select * from (values (1), (2), (NULL)) as sql;
   > 0 rows in set. Query took 0.000 seconds.
   > ❯ select * from foo where exists (select column1 from bar);
   > NotImplemented("Physical plan does not support logical expression EXISTS 
(<subquery>)")
   > ❯ select * from foo where exists (select column1 from bar where 
foo.column1 = bar.column1);
   > +---------+
   > | column1 |
   > +---------+
   > | 2       |
   > | 1       |
   > +---------+
   
   ```sql
   
   > explain select * from foo where exists (select column1 from bar);
   +---------------+-----------------------------------------------------+
   | plan_type     | plan                                                |
   +---------------+-----------------------------------------------------+
   | logical_plan  | LeftSemi Join:                                      |
   |               |   TableScan: foo projection=[column1]               |
   |               |   SubqueryAlias: __correlated_sq_1                  |
   |               |     TableScan: bar projection=[]                    |
   | physical_plan | NestedLoopJoinExec: join_type=RightSemi             |
   |               |   DataSourceExec: partitions=1, partition_sizes=[1] |
   |               |   DataSourceExec: partitions=1, partition_sizes=[1] |
   |               |                                                     |
   +---------------+-----------------------------------------------------+
   2 row(s) fetched. 
   Elapsed 0.007 seconds.
   
   > select * from foo where exists (select column1 from bar);
   +---------+
   | column1 |
   +---------+
   | 1       |
   | 2       |
   | NULL    |
   +---------+
   3 row(s) fetched. 
   Elapsed 0.006 seconds.```
   I get this on `datafusion 45.0.0`, perhaps this issue can be closed or at 
least updated if there is a case where we still don't support EXISTS in 
physical plan.
   


-- 
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