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

Type validation error as ReduceExpressionRule fails to preserve type nullability

    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

      If a simplification could happen after some ReduceExpression rewrite; the simplification result may have a slightly different type in nullability.

        @Test public <T> void testReduceCaseNullabilityChange() throws Exception {
          HepProgram program = new HepProgramBuilder()
              .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
              .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE)
              .build();
      
          try (Hook.Closeable a = Hook.REL_BUILDER_SIMPLIFY.add(Hook.propertyJ(false))) {
            checkPlanning(program,
                "select case when empno = 1 then 1 when 1 IS NOT NULL then 2 else null end as qx "
                    + "from emp");
          }
      

      Exposed by CALCITE-1413 changes; I'm not sure if there is any other variations for which the same could happen.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: