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

AssertionError for checking RexNode implify

    XMLWordPrintableJSON

Details

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

    Description

      When checking implify for RexNode with CAST, get AssertionError.

      The test case in RexImplicationCheckerTest is like this

      @Test public void testRexImplifyWithCast() {
          final Fixture f = new Fixture();
          final RexNode left = f.rexBuilder.makeCall(
              SqlStdOperatorTable.AND,
              f.rexBuilder.makeCall(
                  SqlStdOperatorTable.EQUALS,
                  f.str,
                  f.cast(
                      f.stringDataType,
                      f.literal(1))),
              f.rexBuilder.makeCall(
                  SqlStdOperatorTable.EQUALS,
                  f.i,
                  f.literal(1)));
          final RexNode right = f.rexBuilder.makeCall(
              SqlStdOperatorTable.EQUALS,
              f.i,
              f.literal(1));
          f.checkImplies(left, right);
        }
      

      got exception as below

      java.lang.AssertionError: cannot convert DECIMAL literal to class java.lang.String
      
      	at org.apache.calcite.rex.RexLiteral.getValueAs(RexLiteral.java:1067)
      	at org.apache.calcite.plan.VisitorDataContext.getValue(VisitorDataContext.java:147)
      	at org.apache.calcite.plan.VisitorDataContext.of(VisitorDataContext.java:97)
      	at org.apache.calcite.plan.RexImplicationChecker.implies2(RexImplicationChecker.java:236)
      	at org.apache.calcite.plan.RexImplicationChecker.impliesConjunction(RexImplicationChecker.java:148)
      	at org.apache.calcite.plan.RexImplicationChecker.impliesAny(RexImplicationChecker.java:138)
      	at org.apache.calcite.plan.RexImplicationChecker.implies(RexImplicationChecker.java:124)
      	at org.apache.calcite.test.RexImplicationCheckerTest$Fixture.checkImplies(RexImplicationCheckerTest.java:658)
      	at org.apache.calcite.test.RexImplicationCheckerTest.testRexImplifyWithCast(RexImplicationCheckerTest.java:467)
      

      Attachments

        Issue Links

          Activity

            People

              yanlin-Lynn Wang Yanlin
              yanlin-Lynn Wang Yanlin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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