Description
Issue can be reproduced with following test:
@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")); }
Without fix, builder will generate following plan, which contains an unnecessary field (in Hive, this results in an assertion error in RelFieldTrimmer):
LogicalAggregate(group=[{1}], C=[COUNT()]) LogicalTableScan(table=[[scott, EMP]])
Attachments
Issue Links
- is related to
-
CALCITE-2946 RelBuilder wrongly skips creation of Aggregate that prunes columns if input produces one row at most
- Closed