Repository navigation
fix: preserve compound expression equivalences through projection - #25922
Merged
kumarUjjawal merged 1 commit intoOct 2, 2026
Merged
kumarUjjawal merged 1 commit into
kumarUjjawal merged 1 commit into
Conversation
kumarUjjawal
approved these changes
Oct 1, 2026
kumarUjjawal
left a comment
Contributor
There was a problem hiding this comment.
Thank you @aaron-perpetual for the fix.
Looks good 👍
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25922 +/- ##
========================================
Coverage 82.60% 82.60%
========================================
Files 1144 1144
Lines 442793 442905 +112
Branches 442793 442905 +112
========================================
+ Hits 365779 365874 +95
- Misses 54863 54875 +12
- Partials 22151 22156 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6 of 21 tasks
Omega359
pushed a commit
to Omega359/arrow-datafusion
that referenced
this pull request
Oct 11, 2026
…ache#25922) ## Which issue does this PR close? - Closes apache#25921. ## Rationale for this change Valid queries that sort by a struct field after a left join can fail physical plan validation because a projection loses the equivalence between the field access and an extracted column. ## What changes are included in this PR? Reorder `EquivalenceGroup::project_expr_indirect` to reconstruct an expression from its projected children before substituting an equivalent expression. This preserves equivalences such as `get_field(n, 'label') = extracted_label` when both representations survive the projection. ## What is the testing strategy for this PR? Add SQL regression tests in `joins.slt` covering a left join followed by sorting on a struct field, both with and without an explicitly projected scalar alias. The tests use two partitions to exercise the local sort and sort-preserving merge, and verify the ordered results. The extended workspace tests, physical expression tests, and full lint suite pass. ## Are there any user-facing changes? Affected queries now execute successfully instead of failing physical plan validation. No public API changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Valid queries that sort by a struct field after a left join can fail physical plan validation because a projection loses the equivalence between the field access and an extracted column.
What changes are included in this PR?
Reorder
EquivalenceGroup::project_expr_indirectto reconstruct an expression from its projected children before substituting an equivalent expression. This preserves equivalences such asget_field(n, 'label') = extracted_labelwhen both representations survive the projection.What is the testing strategy for this PR?
Add SQL regression tests in
joins.sltcovering a left join followed by sorting on a struct field, both with and without an explicitly projected scalar alias. The tests use two partitions to exercise the local sort and sort-preserving merge, and verify the ordered results.The extended workspace tests, physical expression tests, and full lint suite pass.
Are there any user-facing changes?
Affected queries now execute successfully instead of failing physical plan validation. No public API changes.