mingmwang commented on PR #5111:
URL: 
https://github.com/apache/arrow-datafusion/pull/5111#issuecomment-1407947251

   
   Should move the calculation logic to the `UnionExec`'s constructor ? Since 
`maintains_input_order()` will be invoked multiple times during the 
optimization process.
   
   ```rust
       fn maintains_input_order(&self) -> Vec<bool> {
           // If the Union has an output ordering, it maintains at least one
           // child's ordering (i.e. the meet).
           // For instance, assume that the first child is 
SortExpr('a','b','c'),
           // the second child is SortExpr('a','b') and the third child is
           // SortExpr('a','b'). The output ordering would be SortExpr('a','b'),
           // which is the "meet" of all input orderings. In this example, this
           // function will return vec![false, true, true], indicating that we
           // preserve the orderings for the 2nd and the 3rd children.
           self.inputs()
               .iter()
               .map(|child| {
                   ordering_satisfy(self.output_ordering(), 
child.output_ordering(), || {
                       child.equivalence_properties()
                   })
               })
               .collect()
       }
   
   ```


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

Reply via email to