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


##########
datafusion/core/src/physical_optimizer/enforce_distribution.rs:
##########
@@ -836,7 +836,9 @@ fn add_roundrobin_on_top(
     n_target: usize,
 ) -> Result<DistributionContext> {
     // Adding repartition is helpful:
-    if input.plan.output_partitioning().partition_count() < n_target {
+    if input.plan.output_partitioning().partition_count() < n_target
+        || input.plan.children().is_empty()
+    {

Review Comment:
   ```suggestion
       if input.plan.output_partitioning().partition_count() < n_target
           || (input.plan.children().is_empty() && 
input.plan.output_partitioning().partition_count() > 1)
       {
   ```
   I think this check handles the intended case better.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to