Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
After some transformations if an "empty" aggregation is present; LoptOptimizeJoinRule may bump into an array index violation.
Original query is complicated; but this small RelMetadataTest testcase reproduces the root cause.
@Test public void testEmptyAggregateNotCausesException() throws Exception { final FrameworkConfig config = RelBuilderTest.config().build(); final RelBuilder builder = RelBuilder.create(config); RelMetadataQuery mq = RelMetadataQuery.instance(); RelNode agg = builder .scan("EMP") .aggregate(builder.groupKey(), Collections.<AggCall> emptyList()).build(); mq.getTableOrigin(agg); }
Exception is:
java.lang.IndexOutOfBoundsException: index (0) must be less than size (0) at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310) at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293) at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67) at org.apache.calcite.rel.metadata.RelMdColumnOrigins.getColumnOrigins(RelMdColumnOrigins.java:77) at GeneratedMetadataHandler_ColumnOrigin.getColumnOrigins_$(Unknown Source) at GeneratedMetadataHandler_ColumnOrigin.getColumnOrigins(Unknown Source) at org.apache.calcite.rel.metadata.RelMetadataQuery.getColumnOrigins(RelMetadataQuery.java:345) at org.apache.calcite.rel.metadata.RelMetadataQuery.getTableOrigin(RelMetadataQuery.java:418) at org.apache.calcite.test.RelMetadataTest.testEmptyAggregateNotCausesException(RelMetadataTest.java:2396)
Attachments
Issue Links
- relates to
-
CALCITE-4317 Some rules fail to handle Aggregate node if RelFieldTrimmer trims all the fields
- Closed
- links to