This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch branch-52
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/branch-52 by this push:
     new 2947378e9e [branch-52] fix: disable dynamic filter pushdown for non 
min/max aggregates (#20279) (#20877)
2947378e9e is described below

commit 2947378e9ef9dbdda75b4ff047edcfc1a06ef0d2
Author: Andrew Lamb <[email protected]>
AuthorDate: Thu Mar 12 14:06:47 2026 -0400

    [branch-52] fix: disable dynamic filter pushdown for non min/max aggregates 
(#20279) (#20877)
    
    - Part of https://github.com/apache/datafusion/issues/20855
    - Closes https://github.com/apache/datafusion/issues/20267 on branch-52
    
    This PR:
    - Backports https://github.com/apache/datafusion/pull/20279 from
    @notashes to the branch-52 line
    
    Co-authored-by: notashes <[email protected]>
    Co-authored-by: Adrian Garcia Badaracco 
<[email protected]>
---
 datafusion/physical-plan/src/aggregates/mod.rs        |  2 +-
 .../test_files/dynamic_filter_pushdown_config.slt     | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/datafusion/physical-plan/src/aggregates/mod.rs 
b/datafusion/physical-plan/src/aggregates/mod.rs
index 06f12a9019..c030507ea3 100644
--- a/datafusion/physical-plan/src/aggregates/mod.rs
+++ b/datafusion/physical-plan/src/aggregates/mod.rs
@@ -980,7 +980,7 @@ impl AggregateExec {
             } else if fun_name.eq_ignore_ascii_case("max") {
                 DynamicFilterAggregateType::Max
             } else {
-                continue;
+                return;
             };
 
             // 2. arg should be only 1 column reference
diff --git 
a/datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt 
b/datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt
index 3e403171e0..6ee6ba0695 100644
--- a/datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt
+++ b/datafusion/sqllogictest/test_files/dynamic_filter_pushdown_config.slt
@@ -257,6 +257,25 @@ physical_plan
 04)------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
 05)--------DataSourceExec: file_groups={1 group: 
[[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/dynamic_filter_pushdown_config/agg_data.parquet]]},
 projection=[score], file_type=parquet, predicate=category@0 = alpha AND 
DynamicFilter [ empty ], pruning_predicate=category_null_count@2 != row_count@3 
AND category_min@0 <= alpha AND alpha <= category_max@1, 
required_guarantees=[category in (alpha)]
 
+# Test 4b: COUNT + MAX — DynamicFilter should NOT appear here in mixed 
aggregates
+
+query TT
+EXPLAIN SELECT COUNT(*), MAX(score) FROM agg_parquet WHERE category = 'alpha';
+----
+logical_plan
+01)Projection: count(Int64(1)) AS count(*), max(agg_parquet.score)
+02)--Aggregate: groupBy=[[]], aggr=[[count(Int64(1)), max(agg_parquet.score)]]
+03)----Projection: agg_parquet.score
+04)------Filter: agg_parquet.category = Utf8View("alpha")
+05)--------TableScan: agg_parquet projection=[category, score], 
partial_filters=[agg_parquet.category = Utf8View("alpha")]
+physical_plan
+01)ProjectionExec: expr=[count(Int64(1))@0 as count(*), 
max(agg_parquet.score)@1 as max(agg_parquet.score)]
+02)--AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1)), 
max(agg_parquet.score)]
+03)----CoalescePartitionsExec
+04)------AggregateExec: mode=Partial, gby=[], aggr=[count(Int64(1)), 
max(agg_parquet.score)]
+05)--------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
+06)----------DataSourceExec: file_groups={1 group: 
[[WORKSPACE_ROOT/datafusion/sqllogictest/test_files/scratch/dynamic_filter_pushdown_config/agg_data.parquet]]},
 projection=[score], file_type=parquet, predicate=category@0 = alpha, 
pruning_predicate=category_null_count@2 != row_count@3 AND category_min@0 <= 
alpha AND alpha <= category_max@1, required_guarantees=[category in (alpha)]
+
 # Disable aggregate dynamic filters only
 statement ok
 SET datafusion.optimizer.enable_aggregate_dynamic_filter_pushdown = false;


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

Reply via email to