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

Cannot translate LogicalLimit to MutableRel when Materialized Views used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      As part of CALCITE-1637 added mutable equivalents for all relational expressions. We need to add for LogicalLimit as well.

      java.sql.SQLException: java.sql.SQLException: Error while executing SQL "SELECT ENTITY_ID FROM TBL_T000011 ORDER BY TYPE LIMIT 5": cannot translate rel#1542:LogicalLimit.NONE.[[1]](input=rel#1541:Subset#2.NONE.[1],fetch=5) to MutableRel
      	at org.apache.phoenix.calcite.CalciteUtils.unwrapSqlException(CalciteUtils.java:1384)
      	at org.apache.calcite.jdbc.PhoenixCalciteFactory$PhoenixCalciteStatement.executeQuery(PhoenixCalciteFactory.java:386)
      	at org.apache.phoenix.end2end.index.MutableIndexIT.testTenantSpecificConnection(MutableIndexIT.java:865)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.junit.runners.Suite.runChild(Suite.java:128)
      	at org.junit.runners.Suite.runChild(Suite.java:27)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      Caused by: java.sql.SQLException: Error while executing SQL "SELECT ENTITY_ID FROM TBL_T000011 ORDER BY TYPE LIMIT 5": cannot translate rel#1542:LogicalLimit.NONE.[[1]](input=rel#1541:Subset#2.NONE.[1],fetch=5) to MutableRel
      	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
      	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
      	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
      	at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
      	at org.apache.calcite.jdbc.PhoenixCalciteFactory$PhoenixCalciteStatement.executeQuery(PhoenixCalciteFactory.java:382)
      	... 35 more
      Caused by: java.lang.RuntimeException: cannot translate rel#1542:LogicalLimit.NONE.[[1]](input=rel#1541:Subset#2.NONE.[1],fetch=5) to MutableRel
      	at org.apache.calcite.rel.mutable.MutableRels.toMutable(MutableRels.java:408)
      	at org.apache.calcite.rel.mutable.MutableRels.toMutable(MutableRels.java:292)
      	at org.apache.calcite.plan.SubstitutionVisitor.<init>(SubstitutionVisitor.java:184)
      	at org.apache.calcite.plan.SubstitutionVisitor.<init>(SubstitutionVisitor.java:174)
      	at org.apache.calcite.plan.MaterializedViewSubstitutionVisitor.<init>(MaterializedViewSubstitutionVisitor.java:47)
      	at org.apache.calcite.plan.RelOptMaterializations.substitute(RelOptMaterializations.java:212)
      	at org.apache.calcite.plan.RelOptMaterializations.useMaterializedViews(RelOptMaterializations.java:76)
      	at org.apache.calcite.plan.volcano.VolcanoPlanner.registerMaterializations(VolcanoPlanner.java:350)
      	at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:592)
      	at org.apache.phoenix.calcite.PhoenixPrograms$1.planFor(PhoenixPrograms.java:219)
      	at org.apache.phoenix.calcite.PhoenixPrograms$1.run(PhoenixPrograms.java:169)
      	at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:387)
      	at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:186)
      	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:319)
      	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:228)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:784)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:639)
      	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:609)
      	at org.apache.phoenix.calcite.PhoenixPrepareImpl.prepareSql(PhoenixPrepareImpl.java:233)
      	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:214)
      	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
      	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
      	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:148)
      	... 37 more
      

      Attachments

        Activity

          People

            rajeshbabu Rajeshbabu Chintaguntla
            rajeshbabu Rajeshbabu Chintaguntla
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: