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

[jira] [Commented] (CALCITE-2438) RexCall#isAlwaysTrue return incorrect result

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

Julian Hyde commented on CALCITE-2438:
--------------------------------------

I think you're right. Clearly NOT should behave similarly to IS_NOT_TRUE (because they have the same behavior on not-null values) but today they have different senses.

With the fix, can you please write some tests for various combinations of IS NOT NULL, IS FALSE, IS TRUE etc. You can check by extending the following query and running against postgres at http://rextester.com/l/postgresql_online_compiler:
{code:sql}select x,
  ((x is null) is not null) is false as c1,
  ((x is null) is not null) is true as c2
from (select null union select 1) as t(x) {code}

{noformat}
   x    c1    c2
==== ===== =====
   1 False  True
NULL False  True
{noformat}


> RexCall#isAlwaysTrue  return incorrect result
> ---------------------------------------------
>
>                 Key: CALCITE-2438
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2438
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: pengzhiwei
>            Assignee: Julian Hyde
>            Priority: Critical
>         Attachments: 屏幕快照 2018-08-02 下午7.26.20.png, 屏幕快照 2018-08-02 下午7.34.26.png
>
>
> In the expression as followed:
> {code:java}
> ((sal IS NULL) IS NOT NULL) IS FALSE
> {code}
> The RexCall#isAlwaysTrue return true,however the correct answer is false.
> I find the reason is that there is a wrong logic in the  isAlwaysTrue,when getKind() is IS_NOT_FALSE、IS_FALSE and IS_NOT_FALSE :
> !屏幕快照 2018-08-02 下午7.34.26.png!
> Can you have a check for me,thanks!



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