[ 
https://issues.apache.org/jira/browse/CALCITE-2675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691215#comment-16691215
 ] 

Yuzhao Chen commented on CALCITE-2675:
--------------------------------------

[~kgyrtkirk] , as far as i know, not only HepPlanner but also Volcano will 
check for type equivalence in RelSet including nodes.

Personally I think doing some greedy deterministic node rewritten is okey just 
like in SqlToRelConverter, cause we will have a more simple construct plan.

I'm a little nervous about removing the invocation of simplification after 
every replacements, shell this fire some unexpected bugs ?

 

> 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
>            Priority: Major
>
> 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