You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Steven Talbot (Jira)" <ji...@apache.org> on 2020/04/24 21:16:00 UTC

[jira] [Commented] (CALCITE-3957) AggregateMergeRule should be able to merge SUM0 into COUNT even with empty group by

    [ https://issues.apache.org/jira/browse/CALCITE-3957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17091906#comment-17091906 ] 

Steven Talbot commented on CALCITE-3957:
----------------------------------------

See some discussion where this was originally implemented on CALCITE-1172

> AggregateMergeRule should be able to merge SUM0 into COUNT even with empty group by
> -----------------------------------------------------------------------------------
>
>                 Key: CALCITE-3957
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3957
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Steven Talbot
>            Priority: Major
>
> Basically, the comment at [https://github.com/apache/calcite/blame/571731b80a58eb095ebac7123285c375e7afff90/core/src/main/java/org/apache/calcite/rel/rules/AggregateMergeRule.java#L117-L120] 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)