You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zhen Chen (Jira)" <ji...@apache.org> on 2025/07/04 00:42:00 UTC

[jira] [Resolved] (CALCITE-7071) Add test for replacing JOIN node with its child node when JOIN condition is false

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

Zhen Chen resolved CALCITE-7071.
--------------------------------
    Resolution: Fixed

> Add test for replacing JOIN node with its child node when JOIN condition is false
> ---------------------------------------------------------------------------------
>
>                 Key: CALCITE-7071
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7071
>             Project: Calcite
>          Issue Type: Test
>            Reporter: Zhen Chen
>            Assignee: Zhen Chen
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.41.0
>
>
> The existing rule combination can already meet this scenario. Now it is modified to add two test cases to show that the combination of CoreRules.JOIN_CONDITION_PUSH + PruneEmptyRules.JOIN_[LEFT/RIGHT]_INSTANCE can eliminate LEFT/RIGHT JOIN when the Join condition is false.
> The above is an example of a left join.
> SQL
> {code:java}
> SELECT e.deptno
> FROM sales.emp e
> LEFT JOIN sales.dept d ON e.deptno = d.deptno and e.deptno between 3 and 1
> {code}
> Plan Before
> {code:java}
> LogicalProject(DEPTNO=[$7])
>   LogicalJoin(condition=[false], joinType=[left])
>     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
>     LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
> {code}
> Plan After
> {code:java}
> LogicalProject(DEPTNO=[$7])
>   LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[null:INTEGER], NAME=[null:VARCHAR(10)])
>     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)