berkaysynnada commented on code in PR #14207:
URL: https://github.com/apache/datafusion/pull/14207#discussion_r1971303497


##########
datafusion/physical-optimizer/src/enforce_distribution.rs:
##########
@@ -987,16 +1003,22 @@ fn add_spm_on_top(input: DistributionContext) -> 
DistributionContext {
 fn remove_dist_changing_operators(
     mut distribution_context: DistributionContext,
 ) -> Result<DistributionContext> {
+    let mut fetch = None;
     while is_repartition(&distribution_context.plan)
         || is_coalesce_partitions(&distribution_context.plan)
         || is_sort_preserving_merge(&distribution_context.plan)
     {
+        if is_sort_preserving_merge(&distribution_context.plan) {

Review Comment:
   BTW, I have also not a clear answer atm, I need to review and remember the 
details. Even if we cannot generalize the rule now, one way to proceed is maybe 
we can update the plans which having fetch currently (like spm and 
coalescePartitions) manually. But, perhaps a more comprehensive fix is what we 
need to fully resolve the issue



-- 
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