Skip to content

Commit

Permalink
Update joins.slt
Browse files Browse the repository at this point in the history
  • Loading branch information
berkaysynnada committed Sep 20, 2024
1 parent aebc58c commit 3a8ec73
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions datafusion/sqllogictest/test_files/joins.slt
Original file line number Diff line number Diff line change
Expand Up @@ -4151,3 +4151,40 @@ DROP TABLE sales_global;

statement ok
DROP TABLE exchange_rates;

# HashJoinExec and NestedLoopJoinExec can propagate SortExec down through its right child.

statement ok
CREATE TABLE left_table(a INT, b INT, c INT)

statement ok
CREATE TABLE right_table(x INT, y INT, z INT)

query TT
EXPLAIN SELECT * FROM left_table JOIN right_table ON left_table.a<right_table.x ORDER BY x;
----
logical_plan
01)Sort: right_table.x ASC NULLS LAST
02)--Inner Join: Filter: left_table.a < right_table.x
03)----TableScan: left_table projection=[a, b, c]
04)----TableScan: right_table projection=[x, y, z]
physical_plan
01)NestedLoopJoinExec: join_type=Inner, filter=a@0 < x@1
02)--MemoryExec: partitions=1, partition_sizes=[0]
03)--SortExec: expr=[x@0 ASC NULLS LAST], preserve_partitioning=[false]
04)----MemoryExec: partitions=1, partition_sizes=[0]

query TT
EXPLAIN SELECT * FROM left_table JOIN right_table ON left_table.a<right_table.x AND left_table.b=right_table.y ORDER BY x;
----
logical_plan
01)Sort: right_table.x ASC NULLS LAST
02)--Inner Join: left_table.b = right_table.y Filter: left_table.a < right_table.x
03)----TableScan: left_table projection=[a, b, c]
04)----TableScan: right_table projection=[x, y, z]
physical_plan
01)CoalesceBatchesExec: target_batch_size=3
02)--HashJoinExec: mode=CollectLeft, join_type=Inner, on=[(b@1, y@1)], filter=a@0 < x@1
03)----MemoryExec: partitions=1, partition_sizes=[0]
04)----SortExec: expr=[x@0 ASC NULLS LAST], preserve_partitioning=[false]
05)------MemoryExec: partitions=1, partition_sizes=[0]

0 comments on commit 3a8ec73

Please sign in to comment.