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

Type mismatch assertion error when creating join condition

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

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

      Description

      Repro:
      in TableFunctionTest.java, add the following test case:

      @Test public void testValuesLateralJoin() {
          final String q1 = "select *\n"
              + "from (values 4) as t (c)\n"
              + "left join lateral table(\"s\".\"fibonacci2\"(c)) as R(n) on c=n";
            with()
                .with(CalciteConnectionProperty.CONFORMANCE,
                    SqlConformanceEnum.LENIENT)
                .query(q1)
                .returnsUnordered("C=4; N=null");
        }
      

      Error message:

      java.lang.AssertionError: type mismatch:
      ref:
      BIGINT NOT NULL
      input:
      BIGINT
      
      	at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31)
      	at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832)
      	at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125)
      	at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57)
      	at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112)
      	at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140)
      	at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57)
      	at org.apache.calcite.rex.RexCall.accept(RexCall.java:190)
      	at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120)
      	at org.apache.calcite.rel.logical.LogicalFilter.<init>(LogicalFilter.java:70)
      	at org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114)
      	at org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101)
      	at org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:295)
      	at org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2413)
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:2065)
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:644)
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:625)
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3080)
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:561)
      

      Even literal is definitely not null, we should still be able to compare the two.

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hyuan Haisheng Yuan

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment