wiedld commented on code in PR #14637: URL: https://github.com/apache/datafusion/pull/14637#discussion_r1958881333
########## datafusion/physical-optimizer/src/enforce_sorting/mod.rs: ########## @@ -546,19 +594,7 @@ fn remove_bottleneck_in_subplan( }) .collect::<Result<_>>()?; } - let mut new_reqs = requirements.update_plan_from_children()?; - if let Some(repartition) = new_reqs.plan.as_any().downcast_ref::<RepartitionExec>() { - let input_partitioning = repartition.input().output_partitioning(); - // We can remove this repartitioning operator if it is now a no-op: - let mut can_remove = input_partitioning.eq(repartition.partitioning()); - // We can also remove it if we ended up with an ineffective RR: - if let Partitioning::RoundRobinBatch(n_out) = repartition.partitioning() { - can_remove |= *n_out == input_partitioning.partition_count(); - } - if can_remove { - new_reqs = new_reqs.children.swap_remove(0) - } - } Review Comment: This is about identifying (and removing) Repartition->Coalesce->Repartition, to make it only a singular repartition. Since the removal decisions were already being made when the context is built, I consolidated this removal decisions to the same place (`update_coalesce_ctx_children`). -- 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