[ 
https://issues.apache.org/jira/browse/CALCITE-2192?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated CALCITE-2192:
---------------------------------
    Summary: RelBuilder might wrongly skip creation of Aggregate that prunes 
columns  (was: RelBuilder might skip creation of Aggregate though it has a 
column pruning effect )

> RelBuilder might wrongly skip creation of Aggregate that prunes columns
> -----------------------------------------------------------------------
>
>                 Key: CALCITE-2192
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2192
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>            Priority: Major
>             Fix For: 1.16.0
>
>
> Issue can be reproduced with following test:
> {code:java}
>   @Test public void testAggregate3() {
>     final RelBuilder builder = RelBuilder.create(config().build());
>     RelNode root =
>         builder.scan("EMP")
>             .aggregate(
>                 builder.groupKey(builder.field(1)),
>                 builder.aggregateCall(SqlStdOperatorTable.COUNT, false, false,
>                     null, "C"))
>             .aggregate(
>                 builder.groupKey(builder.field(0)))
>             .build();
>     assertThat(str(root),
>         is(""
>             + "LogicalProject(ENAME=[$0])\n"
>             + "  LogicalAggregate(group=[{1}], C=[COUNT()])\n"
>             + "    LogicalTableScan(table=[[scott, EMP]])\n"));
>   }
> {code}
> Without fix, builder will generate following plan, which contains an 
> unnecessary field (in Hive, this results in an assertion error in 
> RelFieldTrimmer):
> {code:java}
> LogicalAggregate(group=[{1}], C=[COUNT()])
>     LogicalTableScan(table=[[scott, EMP]])
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to