Julian Hyde created CALCITE-4649:
------------------------------------

             Summary: Add AggregateExpandGroupingSetsRule, a planner rule that 
removes GROUPING SETS
                 Key: CALCITE-4649
                 URL: https://issues.apache.org/jira/browse/CALCITE-4649
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


Add {{class AggregateExpandGroupingSetsRule}}, a planner rule that removes 
{{GROUPING SETS}}.

Some databases do not support {{GROUPING SETS}}. (For example, BigQuery 
supports {{GROUP BY ROLLUP}} but not general {{GROUPING SETS}}.) But {{GROUPING 
SETS}} is a useful construct, increasingly used in user SQL, and also generated 
by rules (e.g. {{AggregateExpandWithinDistinctRule}}).

The proposed rule would match an {{Aggregate}} whose {{groupSets}} field has 
more than one element, and would convert it to an {{Aggregate}} over a {{Join}} 
whose right-hand side is a list of integers, the group ids active in the query. 
Calls to the {{GROUP_ID}} field would be replaced by references to the group id 
column.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to