Kristofferjoha opened a new pull request, #26747:
URL: https://github.com/apache/datafusion/pull/26747

   ## Which issue does this PR close?
   
   Closes #26745.
   
   ## Rationale for this change
   
   An order-preserving repartition can incorrectly retain independent input 
orderings that do not hold after merging partitions. This lets the planner 
remove a necessary sort, causing `ORDER BY` to return rows in the wrong order.
   
   ## What changes are included in this PR?
   
   - Retain only the merge key ordering when repartitioning merges multiple 
input partitions.
   - Preserve projected cast relationships so valid cast-derived orderings can 
still be inferred after the merge.
   - Extend ordering checks to use equivalent expressions without assuming that 
equality implies a strictly order-preserving transformation.
   - Update affected expected plans.
   
   ## What is the testing strategy for this PR?
   
   - Add the issue’s reproduction to `order.slt`, verifying exact row order.
   - Add safety cases in `equivalence_properties.slt` and 
`monotonic_projection_test.slt`.
   - Verify the existing unbounded-stream cast-ordering test continues to pass.
   
   ## Are there any user-facing changes?
   
   Only that queries affected by #26745 now return rows in the requested order.


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