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

   @crepererum 
   Regarding the bug fix, if we still want to keep the functionality of 
`partition-aware` Union, you can fix the rule `SortPushDown` and do not push 
down the sort requirements for partition-aware Union.
   
   In the method `pushdown_requirement_to_children()`
   
   ```rust
   else if is_union(plan) {
           // UnionExec does not have real sort requirements for its input. 
Here we change the adjusted_request_ordering to UnionExec's output ordering and
           // propagate the sort requirements down to correct the unnecessary 
descendant SortExec under the UnionExec
           Ok(Some(vec![
               parent_required.map(|elem| elem.to_vec());
               plan.children().len()
           ]))
   }
   ```
   
   change to
   
   ```rust
   else if let Some(UnionExec {
           partition_aware: false, ..
       }) = plan.as_any().downcast_ref::<UnionExec>()
       {
           // UnionExec does not have real sort requirements for its input. 
Here we change the adjusted_request_ordering to UnionExec's output ordering and
           // propagate the sort requirements down to correct the unnecessary 
descendant SortExec under the UnionExec
           Ok(Some(vec![
               parent_required.map(|elem| elem.to_vec());
               plan.children().len()
           ]))
       }
   ```
   


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