diff --git a/datafusion/src/physical_plan/windows.rs b/datafusion/src/physical_plan/windows.rs index d65e312bdf3e8..62aa34e99e585 100644 --- a/datafusion/src/physical_plan/windows.rs +++ b/datafusion/src/physical_plan/windows.rs @@ -414,7 +414,15 @@ impl ExecutionPlan for WindowAggExec { } fn required_child_distribution(&self) -> Distribution { - Distribution::UnspecifiedDistribution + if self + .window_expr() + .iter() + .all(|expr| expr.partition_by().is_empty()) + { + Distribution::SinglePartition + } else { + Distribution::UnspecifiedDistribution + } } fn with_new_children(