berkaysynnada commented on PR #12414:
URL: https://github.com/apache/datafusion/pull/12414#issuecomment-2342891292

   I think I misled you unintentionally. The part we need to focus on is 
https://github.com/apache/datafusion/blob/3ece7a736193a87941a00eb35f3001df282fd075/datafusion/physical-expr/src/equivalence/properties.rs#L1559-L1578
   
   When I think about what we need to obtain as the finest ordering from the 
union of two children:
   
   ```
   LEFT: orderings: [[a]], constants: [c]
   RIGHT: orderings: [[c]], constants: [a]
   ```
   
   Then the union should have: `orderings: [[a, c], [c, a]], constants: []`.
   
   To get this result, we need to keep track of the left and right constants of 
the children, which are not allowed to be placed in the union's constants. 
Going back to my example above, these child-specific constants can be treated 
as:
   
   ```
   LEFT: orderings: [[a]], constants: [c] → orderings: [[a, c], [c, a]], 
constants: []
   RIGHT: orderings: [[c]], constants: [a] → orderings: [[c, a], [a, c]], 
constants: []
   ```
   
   If we reapply the ordering calculation part I shared above on these updated 
child properties, we should get what we need: `orderings: [[a, c], [c, a]]`, 
which would pass the sanity check for the `[a, c]` ordering.


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