gene-bordegaray commented on code in PR #23480:
URL: https://github.com/apache/datafusion/pull/23480#discussion_r3578074238


##########
datafusion/sqllogictest/test_files/range_partitioning.slt:
##########
@@ -634,6 +634,80 @@ ORDER BY l.range_key;
 30 600
 35 700
 
+##########
+# TEST 18: Sort Merge Join Repartitions Compatible Range Inputs
+# SortMergeJoinExec does not opt into Range satisfying KeyPartitioned. These
+# compatible Range inputs receive Hash repartitions, a future
+# Range satisfaction implementation should remove them.
+##########
+
+statement ok
+set datafusion.optimizer.prefer_hash_join = false;
+
+query TT
+EXPLAIN SELECT l.range_key, l.value, r.value
+FROM range_partitioned l
+JOIN range_partitioned r ON l.range_key = r.range_key;
+----
+physical_plan
+01)ProjectionExec: expr=[range_key@0 as range_key, value@1 as value, value@3 
as value]
+02)--SortMergeJoinExec: join_type=Inner, on=[(range_key@0, range_key@0)]
+03)----SortExec: expr=[range_key@0 ASC], preserve_partitioning=[true]
+04)------RepartitionExec: partitioning=Hash([range_key@0], 4), 
input_partitions=4
+05)--------DataSourceExec: file_groups=<slt:ignore>, projection=[range_key, 
value], output_partitioning=Range([range_key@0 ASC], [(10), (20), (30)], 4), 
file_type=csv, has_header=false
+06)----SortExec: expr=[range_key@0 ASC], preserve_partitioning=[true]
+07)------RepartitionExec: partitioning=Hash([range_key@0], 4), 
input_partitions=4
+08)--------DataSourceExec: file_groups=<slt:ignore>, projection=[range_key, 
value], output_partitioning=Range([range_key@0 ASC], [(10), (20), (30)], 4), 
file_type=csv, has_header=false

Review Comment:
   it is because I did not opt into the range satisfaction since it isn't 
general yet with: `allow_range_satisfaction_for_key_partitioning()`
   
   I didn't do this just because I wanted to do the other operators first but 
with others picking those up I guess there is no reason fro me not to 👍 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to