Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3052

Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): ArrayIndexOutOfBoundsException

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.19.0
    • 1.20.0
    • None

    Description

      Materialized views enabled:

      1. select avg(grade), count(*), max(grade), sum(grade), min(grade), team from students group by team
      2. select avg(grade), count(*), max(grade), sum(grade), min(grade), team, faculty from students group by faculty, team,

      Query:

      1. select count(*), team from students group by team

      Error (stacktrace is obtained using the current master branch: "247c7d4f76"):

      Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
      	at com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60)
      	at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841)
      	at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507)
      	at org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522)
      	at org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776)
      	at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208)
      	... 71 common frames omitted
      

      Reproducible only if both Materialization views listed are enabled: any single one of these two could be successfully used with the query without any errors. Looks like is is reproducible when AbstractMaterializedViewRule is trying to rewrite one materialized view using the another materialized view.
      Currently, I'm trying to reproduce the issue in "MaterializationTest": without a success so far, I'll update the ticket if I'll find a working way to reproduce the issue in the test will be discovered.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jcamachorodriguez Jesus Camacho Rodriguez
            anha Anton Haidai
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m

                Slack

                  Issue deployment