wiedld commented on code in PR #14637:
URL: https://github.com/apache/datafusion/pull/14637#discussion_r1957023902


##########
datafusion/physical-optimizer/src/enforce_sorting/mod.rs:
##########
@@ -126,29 +126,65 @@ fn update_sort_ctx_children(
 /// [`CoalescePartitionsExec`] descendant(s) for every child of a plan. The 
data
 /// attribute stores whether the plan is a `CoalescePartitionsExec` or is
 /// connected to a `CoalescePartitionsExec` via its children.
+///
+/// The tracker halts at each [`SortExec`] (where the SPM will act to replace 
the coalesce).
+///
+/// This requires a bottom-up traversal was previously performed, updating the
+/// children previously.
 pub type PlanWithCorrespondingCoalescePartitions = PlanContext<bool>;

Review Comment:
   I did a refactor. See [this 
commit](https://github.com/apache/datafusion/pull/14637/commits/0661ed7e8934e7f2a711416b85cbafde2a7b99e2).
   * The `parallelize_sorts` and its helper `remove_bottleneck_in_subplan` 
removed more nodes than it should, including needed nodes. Those nodes were 
then added back in a few conditionals. 
   * Instead, if I tightened up the context 
`PlanWithCorrespondingCoalescePartitions` and how it was built in 
`update_coalesce_ctx_children` -- then (a) it avoids excess node removal, and 
also (b) we no longer need to add back nodes later.
   



-- 
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-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to