File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
datafusion/physical-plan/src/aggregates Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -1057,7 +1057,10 @@ impl ExecutionPlan for AggregateExec {
10571057 . flat_map ( |( expr, _) | collect_columns ( expr) )
10581058 . collect ( ) ;
10591059
1060- if !filter_columns. is_subset ( & grouping_columns) {
1060+ // For aggregates with GROUP BY: only allow pushdown if filters reference grouping columns
1061+ // For aggregates without GROUP BY (e.g., SELECT COUNT(*)): allow pushdown of any filter
1062+ // since we're aggregating all rows into a single group anyway
1063+ if !grouping_columns. is_empty ( ) && !filter_columns. is_subset ( & grouping_columns) {
10611064 // Filters reference non-grouping columns - not safe to push through
10621065 let unsupported_filters: Vec < _ > = parent_filters
10631066 . into_iter ( )
You can’t perform that action at this time.
0 commit comments