mustafasrepo commented on code in PR #7090:
URL: https://github.com/apache/arrow-datafusion/pull/7090#discussion_r1274443884


##########
datafusion/core/src/physical_optimizer/sort_enforcement.rs:
##########
@@ -367,11 +369,22 @@ impl PhysicalOptimizerRule for EnforceSorting {
         } else {
             adjusted.plan
         };
+        let plan_with_pipeline_fixer = OrderPreservationContext::new(new_plan);
+        let updated_plan =
+            plan_with_pipeline_fixer.transform_up(&|plan_with_pipeline_fixer| {
+                replace_with_order_preserving_variants(
+                    plan_with_pipeline_fixer,
+                    false,
+                    true,
+                )
+            })?;
+
         // Execute a top-down traversal to exploit sort push-down opportunities
         // missed by the bottom-up traversal:
-        let sort_pushdown = SortPushDown::init(new_plan);
+        let sort_pushdown = SortPushDown::init(updated_plan.plan);
         let adjusted = sort_pushdown.transform_down(&pushdown_sorts)?;
-        adjusted.plan.transform_down(&replace_repartition_execs)
+        // adjusted.plan.transform_down(&replace_repartition_execs)

Review Comment:
   Indeed, thanks



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

Reply via email to