You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2016/03/28 05:48:25 UTC

[jira] [Created] (CALCITE-1172) Add rule to flatten two Aggregate operators into one

Julian Hyde created CALCITE-1172:
------------------------------------

             Summary: Add rule to flatten two Aggregate operators into one
                 Key: CALCITE-1172
                 URL: https://issues.apache.org/jira/browse/CALCITE-1172
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde
            Assignee: Julian Hyde


If there is an Aggregate on top of an Aggregate, and the top aggregate's group key is a subset of the lower aggregate's group key, and the aggregates are expansions of rollups, then a rule would convert into a single aggregate.

For example, SUM of SUM becomes SUM; SUM of COUNT becomes COUNT; MAX of MAX becomes MAX; MIN of MIN becomes MIN. AVG of AVG would not match, nor would COUNT of COUNT.

The rule would convert

{noformat}
Aggregate({x}, SUM(c1), MIN(c2), MAX(c3))
  Aggregate({x, y}, SUM(c1), MIN(c2), MAX(c3))
    R
{noformat}

into

{noformat}
Aggregate({x}, SUM(c1), MIN(c2), MAX(c3))
  R
{noformat}

The rule would not work if there was anything between the two {{Aggregate}} operators.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)