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/21 02:47:00 UTC

[jira] [Commented] (CALCITE-3431) SemiJoinRule doesn't work when right-hand side is not Aggregate but distinct on join keys

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

jin xing commented on CALCITE-3431:
-----------------------------------

Thanks for comment [~julianhyde]

I updated the Jira title to make it more clear ~

I created this Jira because semi-join is not created for the simple sql in the Jira description.

Currently SemiJoinRule is mainly used to create semi-join from sub-query(IN/EXISTS clause). As the discussion on [https://github.com/apache/calcite/pull/1469], rather than refine SemiJoinRule, I would prefer to make a change in SqlToRelConverter and have a direct path from IN/EXISTS to semi- or anti-semi Join

> SemiJoinRule doesn't work when right-hand side is not Aggregate but 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)