Yu Xu created CALCITE-7534:
------------------------------

             Summary: Support GROUPING SETS, CUBE and ROLLUP in materialized 
view aggregate rule rewriting
                 Key: CALCITE-7534
                 URL: https://issues.apache.org/jira/browse/CALCITE-7534
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.41.0
            Reporter: Yu Xu
            Assignee: Yu Xu


The {{MaterializedViewAggregateRule}} in Calcite previously *did not support 
rewriting queries against materialized views that contained {{GROUPING SETS}}* 
(such as {{CUBE}} or {{{}ROLLUP{}}}). Specifically:

There was an explicit check that {*}rejected any aggregate with a 
non-{{{}SIMPLE{}}} group type{*}, causing the rule to bail out immediately with 
a TODO comment:
{code:java}
// TODO: Rewriting with grouping sets not supported yet
if (aggregate.getGroupType() != Aggregate.Group.SIMPLE) {
  return false;
} {code}
As a result, even if a materialized view was defined with grouping sets (e.g., 
GROUP BY CUBE(a, b)), queries against it could never benefit from materialized 
view rewriting, regardless of whether the query itself used grouping sets or a 
simple GROUP BY. This significantly limited the applicability of materialized 
view optimizations for real-world analytic workloads where grouping sets are 
common.

Currently, any *CUBE/ROLLUP/GROUPING SETS* should be abandoned for optimization.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to