xiedeyantu commented on code in PR #5336:
URL: https://github.com/apache/calcite/pull/5336#discussion_r4307587879
##########
core/src/main/java/org/apache/calcite/rel/rules/AggregateReduceFunctionsOnGroupKeysRule.java:
##########
@@ -147,6 +147,11 @@ protected AggregateReduceFunctionsOnGroupKeysRule(Config
config) {
if (!Aggregate.isSimple(aggregate)) {
return null;
}
+ // A global aggregate may return NULL on empty input even when its
Review Comment:
The current rule only supports the MIN, MAX, AVG, and ANY_VALUE aggregate
functions, so I don't think the current fix leaves any issues unresolved.
Perhaps we could also support COUNT through a special rewrite, but I haven't
come up with an efficient approach yet.
I'm not sure if this addresses your concerns. I've added some tests, and I'd
appreciate it if you could take another look when you have time.
--
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]