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

AssertionError in SqlTypeFactoryImpl.leastRestrictive when running slow tests

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.26.0
    • None

    Description

      There are various failures when running slow tests all due to the AssertionError raised in SqlTypeFactoryImpl.leastRestrictive.

      Below a few tests that fail and the respective stacktraces showing the problem:

      LatticeSuggesterTest#testFoodMartAll()

      java.lang.AssertionError
          at org.apache.calcite.sql.type.SqlTypeFactoryImpl.leastRestrictive(SqlTypeFactoryImpl.java:152)
          at org.apache.calcite.rex.RexSimplify$RexSargBuilder.getType(RexSimplify.java:2693)
          at org.apache.calcite.rex.RexSimplify$SargCollector.fix(RexSimplify.java:2631)
          at org.apache.calcite.rex.RexSimplify.lambda$simplifyOrs$8(RexSimplify.java:1762)
          at java.util.ArrayList.forEach(ArrayList.java:1259)
          at org.apache.calcite.rex.RexSimplify.simplifyOrs(RexSimplify.java:1762)
          at org.apache.calcite.rex.RexSimplify.simplifyOr(RexSimplify.java:1736)
          at org.apache.calcite.rex.RexSimplify.simplify(RexSimplify.java:274)
          at org.apache.calcite.rex.RexSimplify.simplifyUnknownAs(RexSimplify.java:243)
          at org.apache.calcite.rex.RexSimplify.simplifyUnknownAsFalse(RexSimplify.java:232)
          at org.apache.calcite.rex.RexSimplify.simplifyFilterPredicates(RexSimplify.java:2484)
          at org.apache.calcite.tools.RelBuilder.filter(RelBuilder.java:1224)
          at org.apache.calcite.tools.RelBuilder.filter(RelBuilder.java:1200)
          at org.apache.calcite.rel.rules.FilterJoinRule.perform(FilterJoinRule.java:179)
          at org.apache.calcite.rel.rules.FilterJoinRule$FilterIntoJoinRule.onMatch(FilterJoinRule.java:377)
          at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:333)
          at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:542)
          at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:407)
          at org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:243)
          at org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
          at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:202)
          at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:189)
          at org.apache.calcite.materialize.LatticeSuggester.addQuery(LatticeSuggester.java:134)
          at org.apache.calcite.materialize.LatticeSuggesterTest$Tester.addQuery(LatticeSuggesterTest.java:818)
          at org.apache.calcite.materialize.LatticeSuggesterTest.checkFoodMartAll(LatticeSuggesterTest.java:309)
          at org.apache.calcite.materialize.LatticeSuggesterTest.testFoodMartAll(LatticeSuggesterTest.java:398)
      

      FoodmartTest#test(FoodmartQuery)[2383]

      java.lang.AssertionError
          at org.apache.calcite.sql.type.SqlTypeFactoryImpl.leastRestrictive(SqlTypeFactoryImpl.java:152)
          at org.apache.calcite.rex.RexSimplify$RexSargBuilder.getType(RexSimplify.java:2693)
          at org.apache.calcite.rex.RexSimplify$SargCollector.fix(RexSimplify.java:2631)
          at org.apache.calcite.rex.RexSimplify.lambda$simplifyOrs$8(RexSimplify.java:1762)
          at java.util.ArrayList.forEach(ArrayList.java:1259)
          at org.apache.calcite.rex.RexSimplify.simplifyOrs(RexSimplify.java:1762)
          at org.apache.calcite.rex.RexSimplify.simplifyOr(RexSimplify.java:1736)
          at org.apache.calcite.rex.RexSimplify.simplify(RexSimplify.java:274)
          at org.apache.calcite.rex.RexSimplify.simplifyList(RexSimplify.java:503)
          at org.apache.calcite.rex.RexSimplify.simplifyAnd(RexSimplify.java:1295)
          at org.apache.calcite.rex.RexSimplify.simplify(RexSimplify.java:272)
          at org.apache.calcite.rex.RexSimplify.simplifyUnknownAs(RexSimplify.java:243)
          at org.apache.calcite.rex.RexSimplify.simplifyUnknownAsFalse(RexSimplify.java:232)
          at org.apache.calcite.rex.RexSimplify.simplifyFilterPredicates(RexSimplify.java:2484)
          at org.apache.calcite.tools.RelBuilder.filter(RelBuilder.java:1224)
          at org.apache.calcite.tools.RelBuilder.filter(RelBuilder.java:1211)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(RelFieldTrimmer.java:596)
          at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:524)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.dispatchTrimFields(RelFieldTrimmer.java:280)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.trimChild(RelFieldTrimmer.java:222)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(RelFieldTrimmer.java:469)
          at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:524)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.dispatchTrimFields(RelFieldTrimmer.java:280)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.trimChild(RelFieldTrimmer.java:222)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(RelFieldTrimmer.java:1015)
          at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:524)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.dispatchTrimFields(RelFieldTrimmer.java:280)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.trimChild(RelFieldTrimmer.java:222)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.trimFields(RelFieldTrimmer.java:627)
          at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:524)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.dispatchTrimFields(RelFieldTrimmer.java:280)
          at org.apache.calcite.sql2rel.RelFieldTrimmer.trim(RelFieldTrimmer.java:169)
          at org.apache.calcite.tools.Programs$TrimFieldsProgram.run(Programs.java:370)
          at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:331)
          at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:166)
          at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:297)
          at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:208)
          at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:632)
          at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:498)
          at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:468)
          at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
          at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:556)
          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.commons.dbcp2.DelegatingStatement.executeQuery(DelegatingStatement.java:310)
          at org.apache.commons.dbcp2.DelegatingStatement.executeQuery(DelegatingStatement.java:310)
          at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:534)
          at org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$runs$4(CalciteAssert.java:1583)
          at org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1474)
          at org.apache.calcite.test.CalciteAssert$AssertQuery.runs(CalciteAssert.java:1581)
          at org.apache.calcite.test.FoodmartTest.lambda$test$0(FoodmartTest.java:154)
      

      Attachments

        Issue Links

        Activity

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

          People

            julianhyde Julian Hyde
            zabetak Stamatis Zampetakis
            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 - 1h 20m
                1h 20m

                Slack

                  Issue deployment