calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesus Camacho Rodriguez (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CALCITE-2192) RelBuilder might skip creation of Aggregate though it has a column pruning effect
Date Sat, 24 Feb 2018 17:50:00 GMT
Jesus Camacho Rodriguez created CALCITE-2192:
------------------------------------------------

             Summary: 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
             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)

Mime
View raw message