You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mustafasrepo (via GitHub)" <gi...@apache.org> on 2023/01/24 14:32:25 UTC

[GitHub] [arrow-datafusion] mustafasrepo commented on a diff in pull request #5035: Change ExecutionPlan::maintains_input_order to return vector (to support multi children executors better)

mustafasrepo commented on code in PR #5035:
URL: https://github.com/apache/arrow-datafusion/pull/5035#discussion_r1085406910


##########
datafusion/core/src/physical_optimizer/sort_enforcement.rs:
##########
@@ -108,13 +107,18 @@ impl TreeNodeRewritable for PlanWithCorrespondingSort {
             let sort_onwards = children_requirements
                 .iter()
                 .map(|item| {
-                    if item.sort_onwards.is_empty() {
-                        vec![]
-                    } else {
-                        // TODO: When `maintains_input_order` returns Vec<bool>,
-                        //       pass the order-enforcing sort upwards.
-                        item.sort_onwards[0].clone()
+                    let onwards = &item.sort_onwards;
+                    if !onwards.is_empty() {
+                        let is_sort = item.plan.as_any().is::<SortExec>();

Review Comment:
   `sort_onwards` starts from `SortExec` till the current executor if the executors in between maintain input order. If we are at the beginning `SortExec` doesn't maintain ordering(it introduces ordering). However, we want to propagate it above anyway. I will add comment explaining this reasoning. Thanks for pointing it out.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org