aaron-perpetual opened a new pull request, #25922:
URL: https://github.com/apache/datafusion/pull/25922

   ## Which issue does this PR close?
   
   - Closes #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 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