[ 
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)

Reply via email to