Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
In RelBuilder, can't get group field by name: "field [ENAME] not found;".
The regression is spotted in 1.22.0 RC 3. The test works fine in 1.21.0 branch.
RelBuilderTest:
@Test public void testGetGroupFieldByName() { final Function<RelBuilder, RelNode> f = builder -> { RelBuilder aggregated = builder.scan("EMP") .project(builder.field("EMPNO"), builder.field("ENAME"), builder.field("SAL")) .aggregate( builder.groupKey(builder.field("ENAME")), builder.sum(builder.field("SAL")) ); RexInputRef groupFieldReference = aggregated.field("ENAME"); assertThat(groupFieldReference.getIndex(), is(0)); return aggregated.build(); }; final String expected = "LogicalAggregate(group=[{1}], agg#0=[SUM($2)])\n" + " LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(f.apply(createBuilder(c -> c)), hasTree(expected)); }
Error (1.22.0 RC 3):
field [ENAME] not found; input fields are: [EMPNO, $f1] java.lang.IllegalArgumentException: field [ENAME] not found; input fields are: [EMPNO, $f1] at org.apache.calcite.tools.RelBuilder.field(RelBuilder.java:402) at org.apache.calcite.tools.RelBuilder.field(RelBuilder.java:385) at org.apache.calcite.test.RelBuilderTest.lambda$testGetGroupFieldByName$15(RelBuilderTest.java:990) at org.apache.calcite.test.RelBuilderTest.testGetGroupFieldByName(RelBuilderTest.java:999) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Attachments
Issue Links
- links to