forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# related to: https://github.com/apache/arrow-datafusion/issues/8374 | ||
statement ok | ||
CREATE TABLE t1(a text, b int) AS VALUES ('Alice', 50), ('Alice', 100); | ||
|
||
statement ok | ||
CREATE TABLE t2(a text, b int) AS VALUES ('Alice', 2), ('Alice', 1); | ||
|
||
# Reset the configs to old values | ||
statement ok | ||
set datafusion.execution.target_partitions = 4; | ||
|
||
statement ok | ||
set datafusion.optimizer.repartition_joins = true; | ||
|
||
# equijoin_and_other_condition (sort merge join) | ||
statement ok | ||
set datafusion.optimizer.prefer_hash_join = false; | ||
|
||
query TT | ||
EXPLAIN SELECT t1.a, t1.b, t2.a, t2.b FROM t1 JOIN t2 ON t1.a = t2.a AND t2.b + 1 > t1.b | ||
---- | ||
logical_plan | ||
Inner Join: t1.a = t2.a Filter: CAST(t2.b AS Int64) + Int64(1) > CAST(t1.b AS Int64) | ||
--TableScan: t1 projection=[a, b] | ||
--TableScan: t2 projection=[a, b] | ||
physical_plan | ||
SortMergeJoin: join_type=Inner, on=[(a@0, a@0)], filter=CAST(b@1 AS Int64) + 1 > CAST(b@0 AS Int64) | ||
--SortExec: expr=[a@0 ASC] | ||
----CoalesceBatchesExec: target_batch_size=8192 | ||
------RepartitionExec: partitioning=Hash([a@0], 4), input_partitions=1 | ||
--------MemoryExec: partitions=1, partition_sizes=[1] | ||
--SortExec: expr=[a@0 ASC] | ||
----CoalesceBatchesExec: target_batch_size=8192 | ||
------RepartitionExec: partitioning=Hash([a@0], 4), input_partitions=1 | ||
--------MemoryExec: partitions=1, partition_sizes=[1] | ||
|
||
query TITI | ||
SELECT t1.a, t1.b, t2.a, t2.b FROM t1 JOIN t2 ON t1.a = t2.a AND t2.b > t1.b | ||
---- | ||
|
||
statement ok | ||
set datafusion.optimizer.prefer_hash_join = true; | ||
|
||
statement ok | ||
DROP TABLE t1; | ||
|
||
statement ok | ||
DROP TABLE t2; |