[improve](nereids) support agg function of count(const value) pushdown #26677

support sql: select count(1)-count(not null) from table, the agg of count could push down.
This commit is contained in:
zhangstar333
2023-11-23 11:26:06 +08:00
committed by GitHub
parent 301bfe4d5d
commit 33de92cc61
2 changed files with 41 additions and 1 deletions

View File

@ -57,7 +57,7 @@ public class CountLiteralToCountStar extends OneRewriteRuleFactory {
.filter(this::isCountLiteral)
.forEach(c -> replaced.put(c, new Count()));
expr = expr.rewriteUp(s -> replaced.getOrDefault(s, s));
changed = !replaced.isEmpty();
changed |= !replaced.isEmpty();
newExprs.add((NamedExpression) expr);
}
return changed;