galaxytemple opened a new pull request, #27347: URL: https://github.com/apache/datafusion/pull/27347
## Which issue does this PR close? - Closes #26625 ## Rationale for this change `calculate_union` had a `TODO` for preserving equivalence classes across UNION inputs. Because this information was dropped, queries like: ```sql SELECT a AS x, a AS y FROM t UNION ALL SELECT a AS x, a AS y FROM t ORDER BY x, y; ``` fail during planning with a SanityCheckPlan error (the parent operator requires [x, y] order, but UnionExec only reported [x] because x = y was lost). ## What changes are included in this PR? - Compute and preserve equivalence conditions that hold across every input partition in calculate_union. - Add unit test in union.rs and sqllogictest test in union.slt. ## What is the testing strategy for this PR? Unit test (union.rs): - Verifies that common equivalence classes are preserved across union inputs. - Tests partial overlap combinations (ensuring non-common equalities are dropped). - Verifies that the preserved equivalence allows ordering_satisfy to pass for composite sort requirements. Sqllogictest (union.slt): - Tests using the reproducer query from #26625. ## Are there any user-facing changes? No API changes. Bug fix only. -- 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]
