Dandandan commented on issue #15177: URL: https://github.com/apache/datafusion/issues/15177#issuecomment-2740754487
Ah actually, the query given by @xudong963 is slightly off, I think it should be the following (without the explicit join): ``` > EXPLAIN (WITH ids AS (SELECT row_id, a FROM t ORDER BY a LIMIT 10) SELECT t.* FROM t WHERE t.row_id IN (SELECT row_id FROM ids)); +---------------+------------------------------------------------------------------------------------------+ | plan_type | plan | +---------------+------------------------------------------------------------------------------------------+ | logical_plan | LeftSemi Join: t.row_id = __correlated_sq_1.row_id | | | TableScan: t projection=[a, b, row_id] | | | SubqueryAlias: __correlated_sq_1 | | | SubqueryAlias: ids | | | Projection: t.row_id | | | Sort: t.a ASC NULLS LAST, fetch=10 | | | Projection: t.row_id, t.a | | | TableScan: t projection=[a, row_id] | | physical_plan | CoalesceBatchesExec: target_batch_size=8192 | | | HashJoinExec: mode=Partitioned, join_type=LeftSemi, on=[(row_id@2, row_id@0)] | | | DataSourceExec: partitions=1, partition_sizes=[0] | | | ProjectionExec: expr=[row_id@0 as row_id] | | | SortExec: TopK(fetch=10), expr=[a@1 ASC NULLS LAST], preserve_partitioning=[false] | | | DataSourceExec: partitions=1, partition_sizes=[0] | | | | +---------------+------------------------------------------------------------------------------------------+ 2 row(s) fetched. Elapsed 0.004 seconds. ``` -- 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