Benchao Li created CALCITE-5201:
-----------------------------------

             Summary: Improve SemiJoinRule to match more cases for semi join
                 Key: CALCITE-5201
                 URL: https://issues.apache.org/jira/browse/CALCITE-5201
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.30.0
            Reporter: Benchao Li
            Assignee: Benchao Li


As disscussed inĀ CALCITE-5195, the following SQL cannot be transformed to semi 
join:

{code:sql}
select * 
from emp
where exists(select * from dept where emp.deptno = dept.deptno and emp.empno = 
dept.deptno)
{code}

Currently {{SemiJoinRule}} requires that right child must be an {{Aggregate}}, 
however, sometimes it's not, e.g. in 
[{{RelBuilder}}|https://github.com/apache/calcite/blob/300f5200fe50870da418366613df1cd09921b1b6/core/src/main/java/org/apache/calcite/tools/RelBuilder.java#L2241-L2247],
 if the group keys are unique, then we'll remove the {{Aggregate}}.




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to