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


##########
datafusion/core/src/physical_optimizer/enforce_sorting.rs:
##########
@@ -162,8 +162,18 @@ impl PhysicalOptimizerRule for EnforceSorting {
         // remove unnecessary sorts, and optimize sort-sensitive operators:
         let adjusted = plan_requirements.transform_up(&ensure_sorting)?.data;
         let new_plan = if config.optimizer.repartition_sorts {
-            let plan_with_coalesce_partitions =
+            let data_vec: Vec<_> = adjusted.children.iter().map(|x| 
x.data).collect();
+            let mut plan_with_coalesce_partitions =
                 
PlanWithCorrespondingCoalescePartitions::new_default(adjusted.plan);
+            plan_with_coalesce_partitions.children = 
plan_with_coalesce_partitions
+                .children
+                .into_iter()
+                .enumerate()
+                .map(|(id, mut child)| {
+                    child.data = data_vec[id];
+                    child
+                })
+                .collect();

Review Comment:
   I think these changes are still unnecessary for this PR. Other than this, 
this PR is ready to merge. Thanks @Lordworms for this Pr.



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