You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2023/01/13 21:26:53 UTC
[GitHub] [arrow-datafusion] ozankabak commented on a diff in pull request #4885: Do not repartition inputs whose sort order is required
ozankabak commented on code in PR #4885:
URL: https://github.com/apache/arrow-datafusion/pull/4885#discussion_r1070081678
##########
datafusion/core/src/physical_optimizer/repartition.rs:
##########
@@ -163,10 +178,34 @@ fn optimize_partitions(
.children()
.iter()
.map(|child| {
+ // does plan itelf (not parent) require its input to
+ // be sorted in some way?
+ let required_input_ordering =
+ plan_has_required_input_ordering(plan.as_ref());
+
+ let can_reorder_child = if can_reorder {
+ // parent of `plan` will not use any particular order
+
+ // if `plan` itself doesn't need order OR
+ !required_input_ordering ||
+ // child has no order to preserve
+ child.output_ordering().is_none()
+ } else {
+ // parent would like to use the `plan`'s output
+ // order.
+
+ // if `plan` doesn't maintain the input order and
+ // doesn't need the child's output order itself
+ (!plan.maintains_input_order() && !required_input_ordering) ||
+ // child has no ordering to preserve
+ child.output_ordering().is_none()
+ };
Review Comment:
Sure; will take a look, discuss with the team and get back to you.
--
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