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

Type validation error as ReduceExpressionRule fails to preserve type nullability

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.18.0
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: