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

Materialized view: "target out of range" error

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.19.0
    • Fix Version/s: 1.21.0
    • Component/s: None

      Description

      "MaterializationTest":

      @Test public void testPermutationError() {
          CalciteAssert.that()
              .withMaterializations(
                  HR_FKUK_MODEL,
                  "m0",
                  "select min(\"salary\"), count(*), max(\"salary\"), sum(\"salary\"), \"empid\" from \"emps\" group by \"empid\"",
                  "m1",
                  "select min(\"salary\"), count(*), max(\"salary\"), sum(\"salary\"), \"deptno\", \"empid\" from \"emps\" group by \"empid\", \"deptno\""
              )
              .query(
                  "select count(*), \"empid\" from \"emps\" group by \"empid\"")
              .enableMaterializations(true)
              .explainContains("EnumerableTableScan(table=[[hr, m0]])")
              .sameResultWithMaterializationsDisabled();
        }
      

      Error (looks like the mapping is expected to be bijection but it is not):

      Caused by: java.lang.IllegalArgumentException: target out of range
      	at org.apache.calcite.util.Permutation.<init>(Permutation.java:69)
      	at org.apache.calcite.util.mapping.Mappings.bijection(Mappings.java:394)
      	at org.apache.calcite.rel.mutable.MutableRels.createProject(MutableRels.java:142)
      	at org.apache.calcite.plan.SubstitutionVisitor.unifyAggregates(SubstitutionVisitor.java:1269)
      	at org.apache.calcite.plan.SubstitutionVisitor$AggregateOnProjectToAggregateUnifyRule.apply(SubstitutionVisitor.java:1345)
      	at org.apache.calcite.plan.SubstitutionVisitor.go(SubstitutionVisitor.java:531)
      	at org.apache.calcite.plan.SubstitutionVisitor.go(SubstitutionVisitor.java:466)	
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                donnyzone Feng Zhu
                Reporter:
                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 - 20m
                  20m