geoffreyclaude opened a new pull request, #27331: URL: https://github.com/apache/datafusion/pull/27331
## Which issue does this PR close? - Backport of https://github.com/apache/datafusion/pull/27060 to `branch-56`. - Fixes https://github.com/apache/datafusion/issues/26162 on the 56 release line. - Part of https://github.com/apache/datafusion/issues/24461. ## Rationale for this change A finer ordering pushed below `SortPreservingMergeExec` is lost when the merge keeps fewer keys. This produces incorrectly ordered results and can make a window query fail plan validation. Downstream testing still reproduces the failure in the 56 line. The original fix merged after `branch-56` was cut and is needed before the DataFusion 56 release candidate. ## What changes are included in this PR? Cherry-pick `3f4a37fbabdcb07705db6341268e6c0b34da0d34` from #27060. Keep the finer parent sort above the merge, together with the original regression tests. The `limit.slt` conflict was append context from an unrelated test absent on `branch-56`; only the original #26162 regression block is added. ## What is the testing strategy for this PR? Carries the original `limit.slt` checks for ordered output, a window, an ordered aggregate and a UNION, plus the physical-plan regression for a merge without a fetch. `cargo fmt --all`, both targeted physical-plan tests and the `limit.slt` checks passed. Reverting the optimizer change makes the new non-fetched-merge regression fail. Local validation passed: - Prescribed extended workspace suite: 13,467 Rust tests and all 545 SQL files; zero failures, eight existing ignored tests. - CLI tests: 116 passed. - `./dev/rust_lint.sh`: all 21 checks passed, including both Clippy feature selections with `-D warnings`, Rustdoc and Sphinx. ## Are there any user-facing changes? Queries retain their requested ordering above sort-preserving merges. No public API changes. -- 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]
