You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "yanjing.wang (Jira)" <ji...@apache.org> on 2021/06/07 03:24:00 UTC

[jira] [Commented] (CALCITE-4637) is not null in case is lost

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

yanjing.wang commented on CALCITE-4637:
---------------------------------------

I guess whatever NULL < Number expression will result NULL with Boolean Type, so b < 8 implies b is not null(null < 8 results false). Finally b is not null and b < 8 can be simplified to be b < 8. But I'm not sure.

see CALCITE-1116 and [Null Values Comparing|http://www.silota.com/docs/recipes/sql-null-compare-sort-coalesce-joining.html] 

> is not null in case is lost
> ---------------------------
>
>                 Key: CALCITE-4637
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4637
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.21.0
>            Reporter: bocaiding
>            Priority: Major
>             Fix For: next
>
>
> I found a query like below will lost condition.
> select case when a > 9 and b is not null and b < 8 then c end from tbl
> the "b is not null" get lost.
>  
> i.e. add such a test case in RexProgramTest will fail:
> checkSimplifyUnchanged(
>  case_(and(gt(vIntNotNull(0), literal(9)), lt(vInt(1), literal(8)), isNotNull(vInt(1))),
>  literal(7), literal(6)));



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