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

RelSubSet's best is not existed in the set

    XMLWordPrintableJSON

    Details

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

      Description

      To repro this, add below code in VolcanoPlanner.isValid() which verifies RelSubset.best indeed belongs to its set -

              // Make sure best RelNode is valid
              if (subset.best != null && !subset.set.rels.contains(subset.best)) {
                return litmus.fail("RelSubSet [{}] has best RelNode [{}] which is not existed in its set.",
                        subset.getDescription(), subset.best.getDescription());
              }
      

      Run JDBCTest.testVarcharEquals, you will get below exception -

      java.lang.AssertionError: RelSubSet rel#6828:Subset#2.JDBC.foodmart.[] has best RelNode rel#6871:JdbcProject.JDBC.foodmart.[](input=RelSubset#6844,lname=$2) which is not existed in its set.

      at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31)
      at org.apache.calcite.plan.volcano.VolcanoPlanner.isValid(VolcanoPlanner.java:888)
      at org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:851)
      at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:868)
      at org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1939)
      at org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:129)
      at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:236)
      at org.apache.calcite.rel.convert.ConverterRule.onMatch(ConverterRule.java:141)
      at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208)
      at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:631)
      at org.apache.calcite.tools.Programs.lambda$standard$3(Programs.java:286)
      at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:346)
      at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:189)
      at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:320)
      at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:231)
      at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:638)
      at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:502)
      at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:472)
      at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
      at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:550)
      at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
      at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
      at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
      at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:522)
      at org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1466)
      at org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1398)
      at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1464)
      at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1447)
      at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1410)
      at org.apache.calcite.test.JdbcTest.testVarcharEquals(JdbcTest.java:4420)
      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:498)
      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.runner.JUnitCore.run(JUnitCore.java:137)
      at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
      at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      Suppressed: org.apache.calcite.util.TestUtil$ExtraInformation: With materializationsEnabled=false, limit=0, sql=select count as c from "customer" where "lname" = 'this string is longer than 30 characters'
      at org.apache.calcite.util.TestUtil.rethrow(TestUtil.java:268)
      at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:554)
      ... 28 more

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                xndai Xiening Dai
              • Votes:
                0 Vote for this issue
                Watchers:
                4 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 - 2h 20m
                  2h 20m