Zoltan Haindrich created CALCITE-2675:
-----------------------------------------

             Summary: ReduceExpressionRule may leave behind altered types w.r.t 
nullability
                 Key: CALCITE-2675
                 URL: https://issues.apache.org/jira/browse/CALCITE-2675
             Project: Calcite
          Issue Type: Bug
            Reporter: Zoltan Haindrich
            Assignee: Zoltan Haindrich


If a simplification could happen after some [ReduceExpression 
rewrite|https://github.com/apache/calcite/blob/fcc8bf7f44f92efb3c9a1e1f51ffc1a09cab27b9/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java#L794];
 the simplification result may have a slightly different type in nullability. 
{code}
  @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");
    }
{code}

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



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to