You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2018/07/02 13:02:00 UTC

[jira] [Commented] (CALCITE-2393) RexSimplify optimization error for expression 'x is not null and x <> 5'

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

Zoltan Haindrich commented on CALCITE-2393:
-------------------------------------------

I would like to try to convince you that its working correctly:

* any operation involving unknown results in unknown; so: the result of (x<>5) when x is null: is null (unknown)
* if "x is null" then "x<>5 is null" which is false; because of the setting of unknownAsFalse

I know its a little bit confusing sometimes...

> RexSimplify optimization error for expression  'x is not null and x <> 5'
> -------------------------------------------------------------------------
>
>                 Key: CALCITE-2393
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2393
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.16.0
>            Reporter: pengzhiwei
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.17.0
>
>
>    After the optimization of RexSimplify,the expression 'x is not null and x <> 5' (x is nullable) is optimized to 'x<> 5' (RexSimplify#unknownAsFalse is true).  I think it is not a correct result because when x is null, null<> 5 should return true,while 'x is not null and x <> 5' return false.
>   I think the optimization for "is not null" in RexSimplify#simplifyAnd2ForUnknownAsFalse should exclude the case of not-equal operator.
>  I really confused with this optimization, can you give some suggestion,thanks! 
>  
>   
>          



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