mingmwang commented on code in PR #5171:
URL: https://github.com/apache/arrow-datafusion/pull/5171#discussion_r1099889802
##########
datafusion/core/src/physical_optimizer/sort_enforcement.rs:
##########
@@ -58,23 +60,47 @@ impl EnforceSorting {
}
}
-/// This is a "data class" we use within the [EnforceSorting] rule that
-/// tracks the closest `SortExec` descendant for every child of a plan.
+/// This object implements a tree that we use while keeping track of paths
+/// leading to `SortExec`s.
+#[derive(Debug, Clone)]
+struct ExecTree {
+ /// Child index of the plan in its parent
+ pub idx: usize,
+ /// Children of the plan that would need updating if we remove leaf
executors
+ pub children: Vec<ExecTree>,
+ /// The `ExecutionPlan` associated with this node
+ pub plan: Arc<dyn ExecutionPlan>,
+}
+
Review Comment:
Nice! This abstraction is much cleaner and easy to understand than before !
--
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]