lyne7-sc commented on code in PR #25053:
URL: https://github.com/apache/datafusion/pull/25053#discussion_r3974992424


##########
datafusion/sqllogictest/test_files/joins.slt:
##########
@@ -6300,3 +6300,86 @@ reset datafusion.optimizer.repartition_file_scans;
 
 statement ok
 set datafusion.execution.target_partitions = 4;
+
+# Duplicate probe keys restart the build-side ordering for each matching row.
+statement ok
+set datafusion.execution.target_partitions = 2;
+
+statement ok
+set datafusion.optimizer.prefer_hash_join = false;
+
+statement ok
+CREATE TABLE duplicate_join_left AS VALUES (1, 10), (1, 20), (2, 30);
+
+statement ok
+CREATE TABLE duplicate_join_right AS VALUES (1, 100), (1, 200), (2, 300);
+
+# Sorting the build side alone must not satisfy the output ordering.
+query II
+SELECT l.column1, r.column2
+FROM duplicate_join_left l JOIN duplicate_join_right r ON l.column1 = r.column1
+ORDER BY l.column1, r.column2;
+----
+1 100
+1 100
+1 200
+1 200
+2 300
+
+query II
+SELECT l.column1, r.column2
+FROM duplicate_join_left l JOIN duplicate_join_right r ON l.column1 = r.column1
+ORDER BY l.column1, r.column2 LIMIT 2;

Review Comment:
   Thanks. I’ve added the suggested test and verified that it fails on the 
pre-fix commit (f96892a) and passes on the updated branch.



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