You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Wang Yanlin (Jira)" <ji...@apache.org> on 2019/09/29 08:00:00 UTC

[jira] [Created] (CALCITE-3378) AssertionError for checking RexNode implify

Wang Yanlin created CALCITE-3378:
------------------------------------

             Summary: AssertionError for checking RexNode implify
                 Key: CALCITE-3378
                 URL: https://issues.apache.org/jira/browse/CALCITE-3378
             Project: Calcite
          Issue Type: Bug
            Reporter: Wang Yanlin


When checking implify for RexNode with CAST, get AssertionError.

The test case in *RexImplicationCheckerTest* is like this
{code:java}
@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);
  }
{code}

got exception as below

{code:java}
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)
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)