You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2019/10/31 10:08:00 UTC

[jira] [Commented] (CALCITE-3464) RexSimplify simplifies plan having filter with NULL to empty values

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

Stamatis Zampetakis commented on CALCITE-3464:
----------------------------------------------

Hi [~yanlin-Lynn],

name = NULL is unknown and in the case of a where clause unknown is considered as false so the behavior above seems normal.

Do you see a problem with that?

> RexSimplify simplifies plan having filter with NULL to empty values
> -------------------------------------------------------------------
>
>                 Key: CALCITE-3464
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3464
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Wang Yanlin
>            Priority: Major
>
> When filter by  comparing to null in sql, the plan will get empty result
> {code:java}
> @Test public void testSimplifyItemEqualNull() {
>     String query = "select * from sales.customer as t1 where name = NULL";
>     sql(query)
>         .withTester(t -> createDynamicTester())
>         .withRule(ReduceExpressionsRule.FILTER_INSTANCE)
>         .check();
>   }
> {code}
> The plan after optimization is like this
> {code:java}
> LogicalProject(**=[$1])
>   LogicalValues(tuples=[[]])
> {code}
> The optimized plan will get empty result, is this the result we want?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)