alamb commented on code in PR #8127:
URL: https://github.com/apache/arrow-datafusion/pull/8127#discussion_r1389728281


##########
datafusion/core/src/physical_optimizer/enforce_sorting.rs:
##########
@@ -1053,6 +1074,28 @@ mod tests {
         Ok(())
     }
 
+    #[tokio::test]
+    async fn test_repartition_with_unecessary_preserve_order() -> Result<()> {

Review Comment:
   
   I am not super happy with the test as it isn't a test of the optimizer, but 
the only time this can cause problems is when RepartitionExec::with_new_child 
is called, which I found really hard to
   trigger with the optimizer tests.
   
   Without the code in this PR, this test fails like:
   
   ```
   [
       "SortPreservingRepartitionExec: partitioning=RoundRobinBatch(10), 
input_partitions=2",
       "  UnionExec",
       "    MemoryExec: partitions=1, partition_sizes=[0]",
       "    MemoryExec: partitions=1, partition_sizes=[0]",
   ]
   actual:
   
   [
       "RepartitionExec: partitioning=RoundRobinBatch(10), input_partitions=2",
       "  UnionExec",
       "    MemoryExec: partitions=1, partition_sizes=[0]",
       "    MemoryExec: partitions=1, partition_sizes=[0]",
   ]
   ```



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