[
https://issues.apache.org/jira/browse/CALCITE-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14228449#comment-14228449
]
Julian Hyde commented on CALCITE-461:
-------------------------------------
{{if (Bug.CALCITE_461_FIXED) ...}} marks out some of the cases, but not all. To
be sure, you should look for all rules that act on Aggregates. They will have
an operand that acts on an Aggregate.class or a sub-type. Usually they will be
named AggregateXxxxVerbRule or XxxAggregateVerbRule. An example is
{{AggregateUnionAggregateRule}}:
{code}
private AggregateUnionAggregateRule() {
super(
operand(LogicalAggregate.class, null, Aggregate.IS_SIMPLE,
operand(LogicalUnion.class,
operand(RelNode.class, any()),
operand(RelNode.class, any()))));
}
{code}
and {{FilterAggregateTransposeRule}} is another.
Add a test to {{RelOptRulesTest}} for each such rule applied to an aggregate
with grouping sets, then change the rule so that the test passes.
{{FilterAggregateTransposeRule}} is tested by
{{RelOptRulesTest.testPushFilterPastAgg}}:
{code]
@Test public void testPushFilterPastAgg() {
checkPlanning(FilterAggregateTransposeRule.INSTANCE,
"select dname, c from"
+ " (select name dname, count(*) as c from dept group by name) t"
+ " where dname = 'Charlie'");
}
{code}
you could add a similar test
{code]
@Test public void testPushFilterPastAggWithGropingSets() {
checkPlanning(FilterAggregateTransposeRule.INSTANCE,
"select dname, c from"
+ " (select name dname, count(*) as c from dept group by
rollup(name)) t"
+ " where dname = 'Charlie'");
}
{code}
Note that {{group by rollup}} is sufficient to cause {{Aggregate.indicator}} to
be set to true. If the rule can handle that, it is reasonable to assume that it
can handle {{group by cube}} and {{group by grouping sets}} too.
Some rules, e.g. {{AggregateUnionAggregateRule}} do not seem to have tests in
RelOptRulesTest. Sorry about that... we're not perfect.
> Convert more planner rules to handle grouping sets
> --------------------------------------------------
>
> Key: CALCITE-461
> URL: https://issues.apache.org/jira/browse/CALCITE-461
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Jesus Camacho Rodriguez
>
> Very few planner rules can handle non-simple Aggregates.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)