You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2018/11/30 14:46:00 UTC

[jira] [Created] (HIVE-20991) Presence of an empty aggregation should not lead to Exceptions

Zoltan Haindrich created HIVE-20991:
---------------------------------------

             Summary: Presence of an empty aggregation should not lead to Exceptions
                 Key: HIVE-20991
                 URL: https://issues.apache.org/jira/browse/HIVE-20991
             Project: Hive
          Issue Type: Bug
            Reporter: Zoltan Haindrich
            Assignee: Zoltan Haindrich


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.

{code}
  @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);
  }
{code}

Exception is:

{code}
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)
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)