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

[jira] [Updated] (CALCITE-3431) SemiJoinRule doesn't work when right-hand side is natural distinct on join keys

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

jin xing updated CALCITE-3431:
------------------------------
    Description: 
Calcite generate semi-join by SemiJoinRule, which only works on pattern of Join(RelNode, Aggregate).

Take below sql as an example 
{code:java}
 select * from dept 
 where exists (
  select * from emp
  where emp.empno = dept.deptno)
{code}
If empno is a key column of emp, thus the original plan is as below
{code:java}
LogicalProject(DEPTNO=[$0], NAME=[$1])
  LogicalJoin(condition=[=($0, $2)], joinType=[inner])
    LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
    LogicalProject(EMPNO=[$0])
      LogicalTableScan(table=[[CATALOG, SALES, EMP]])
{code}
Thus SemiJoinRule cannot support such a pattern

 

 

> SemiJoinRule doesn't work when right-hand side is natural distinct on join keys
> -------------------------------------------------------------------------------
>
>                 Key: CALCITE-3431
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3431
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: jin xing
>            Assignee: jin xing
>            Priority: Major
>
> Calcite generate semi-join by SemiJoinRule, which only works on pattern of Join(RelNode, Aggregate).
> Take below sql as an example 
> {code:java}
>  select * from dept 
>  where exists (
>   select * from emp
>   where emp.empno = dept.deptno)
> {code}
> If empno is a key column of emp, thus the original plan is as below
> {code:java}
> LogicalProject(DEPTNO=[$0], NAME=[$1])
>   LogicalJoin(condition=[=($0, $2)], joinType=[inner])
>     LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
>     LogicalProject(EMPNO=[$0])
>       LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> Thus SemiJoinRule cannot support such a pattern
>  
>  



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