[
https://issues.apache.org/jira/browse/CALCITE-2192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16375702#comment-16375702
]
Jesus Camacho Rodriguez commented on CALCITE-2192:
--------------------------------------------------
[~julianhyde], I have created a PR in
[https://github.com/apache/calcite/pull/636] , could you review it? Thanks
> RelBuilder might skip creation of Aggregate though it has a column pruning
> effect
> ----------------------------------------------------------------------------------
>
> 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)