You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/02/25 05:33:00 UTC

[jira] [Resolved] (CALCITE-2192) RelBuilder wrongly skips creating an Aggregate that prunes columns, if input is unique

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

Julian Hyde resolved CALCITE-2192.
----------------------------------
    Resolution: Fixed

Fixed in [3ce09bdb|http://git-wip-us.apache.org/repos/asf/calcite/commit/3ce09bdb].

> RelBuilder wrongly skips creating an Aggregate that prunes columns, if input is unique
> --------------------------------------------------------------------------------------
>
>                 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)