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

Is distinct from could lead to Exceptions in ReduceExpressionRule

    XMLWordPrintableJSON

    Details

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

      Description

      Test:

        @Test
        public void testReduceConstants4() throws Exception {
          HepProgram program = new HepProgramBuilder()
              .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE)
              .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
              .addRuleInstance(ReduceExpressionsRule.JOIN_INSTANCE)
              .build();
      
          String sql = "select e.mgr is not distinct from f.mgr from emp e join emp f on (e.mgr=f.mgr) where e.mgr is null";
          sql(sql).with(program)
              .check();
        }
      

      Unfortunately the exception doesn't have a stacktrace by default; just some type:

      org.apache.calcite.adapter.enumerable.RexToLixTranslator$AlwaysNull
      

      Translation is not possible at this point: https://github.com/apache/calcite/blob/d32ee5c320938b5c34ce09df2276c9570c27a301/core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java#L746

      the underlying rexNode is:

      CAST(null):INTEGER NOT NULL
      

      which is problematic

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kgyrtkirk Zoltan Haindrich
                Reporter:
                kgyrtkirk Zoltan Haindrich
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: