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 2021/09/30 19:26:00 UTC

[jira] [Resolved] (CALCITE-4805) Calcite should convert a small IN-list as if the user had written OR, even if the IN-list contains NULL

     [ https://issues.apache.org/jira/browse/CALCITE-4805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde resolved CALCITE-4805.
----------------------------------
    Resolution: Fixed

Fixed in [5b8ce9c4|https://github.com/apache/calcite/commit/5b8ce9c477dcf6ea4848b14982a11bd2e6ebe556]; thanks for the PR, [~nobigo]!

> Calcite should convert a small IN-list as if the user had written OR, even if the IN-list contains NULL
> -------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4805
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4805
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: duan xiong
>            Assignee: duan xiong
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.28.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Since CALCITE-373 Calcite has converted "x IN (1, 2)" to "x = 1 OR x = 2" but it still converts "x IN (1, NULL)" to "x IN (VALUES 1, NULL)" and that, since some bugs have been fixed, there's no good reason for the difference.
> For example:
> {code:java}
> select * from emp where deptno in (null,2){code}
> Now the RelNode is:
> {code:java}
> LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
>  LogicalJoin(condition=[=($7, $9)], joinType=[inner])
>  LogicalTableScan(table=[[CATALOG, SALES, EMP]])
>  LogicalAggregate(group=[{0}])
>  LogicalValues(tuples=[[{ null }, { 2 }]]){code}
> The RelNode should be:
> {code:java}
> LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
>  LogicalFilter(condition=[OR(=($7, null), =($7, 2))])
>  LogicalTableScan(table=[[CATALOG, SALES, EMP]]){code}



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