[
https://issues.apache.org/jira/browse/CALCITE-3957?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrei Sereda closed CALCITE-3957.
----------------------------------
Released as part of 1.25
([68b02dfd4af15bc|https://github.com/apache/calcite/commit/68b02dfd4af15bc94a91a0cd2a30655d04439555])
> AggregateMergeRule should merge SUM0 into COUNT even if GROUP BY is empty
> -------------------------------------------------------------------------
>
> Key: CALCITE-3957
> URL: https://issues.apache.org/jira/browse/CALCITE-3957
> Project: Calcite
> Issue Type: Bug
> Reporter: Steven Talbot
> Assignee: Julian Hyde
> Priority: Major
> Fix For: 1.25.0
>
>
> {{AggregateMergeRule}} should merge {{SUM0}} into {{COUNT}} even if {{GROUP
> BY}} is empty.
> Basically, the comment inĀ
> [AggregateMergeRule|https://github.com/apache/calcite/blame/571731b80a58eb095ebac7123285c375e7afff90/core/src/main/java/org/apache/calcite/rel/rules/AggregateMergeRule.java#L117-L120],
> bq. Should not merge if top agg with empty group keys and the lower agg
> function is COUNT, because in case of empty input for lower agg, the result
> is empty, if we merge them, we end up with 1 result with 0, which is wrong.
> does not apply if the top aggregate is a SUM0, I believe. Without a fix for
> this, there's this one case where this rule falls down and isn't able to
> merge something that just got rolled up: otherwise it's a pretty nice
> invariant that if one of our standard rollup rules for aggregates (say, in
> {{MaterializedViewRule}}) just split the aggregate, this rule should be able
> to merge it back.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)