adriangb commented on code in PR #20279:
URL: https://github.com/apache/datafusion/pull/20279#discussion_r2791223994
##########
datafusion/physical-plan/src/aggregates/mod.rs:
##########
@@ -1129,6 +1129,16 @@ impl AggregateExec {
return;
}
+ // Don't push the dynamic filter if the query includes aggregates like
+ // COUNT, SUM, AVG as they usually require all of the rows matching
the WHERE clause
+ let has_non_minmax = self.aggr_expr.iter().any(|aggr_expr| {
+ let fun_name = aggr_expr.fun().name();
+ !fun_name.eq_ignore_ascii_case("min") &&
!fun_name.eq_ignore_ascii_case("max")
Review Comment:
Aren't we already doing this check on lines 1141 -> 1151?
```
// 1. Only `min` or `max` aggregate function
let fun_name = aggr_expr.fun().name();
// HACK: Should check the function type more precisely
// Issue: <https://github.com/apache/datafusion/issues/18643>
let aggr_type = if fun_name.eq_ignore_ascii_case("min") {
DynamicFilterAggregateType::Min
} else if fun_name.eq_ignore_ascii_case("max") {
DynamicFilterAggregateType::Max
} else {
continue;
};
```
I'm guessing the only thing that is needed is to change `continue;` to
`return;`
--
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]