Zhen Chen created CALCITE-7623:
----------------------------------

             Summary: SemiJoinProjectTransposeRule should support ANTI joins
                 Key: CALCITE-7623
                 URL: https://issues.apache.org/jira/browse/CALCITE-7623
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.42.0
            Reporter: Zhen Chen
            Assignee: Zhen Chen
             Fix For: 1.43.0


{{SemiJoinProjectTransposeRule}} currently only matches {{SEMI}} joins via 
{{{}Join::isSemiJoin{}}}, but the same left-side project transpose is valid for 
{{ANTI}} joins because both {{SEMI}} and {{ANTI}} joins only project fields 
from the left input.

For example:
{code:java}
LogicalJoin(condition=[=($1, $9)], joinType=[anti])
  LogicalProject(DNAME=[$1], DEPTNO=[$0])
    LogicalTableScan(table=[[scott, DEPT]])
  LogicalTableScan(table=[[scott, EMP]]) {code}
can be transformed to:
{code:java}
LogicalProject(DNAME=[$1], DEPTNO=[$0])
  LogicalJoin(condition=[=($0, $10)], joinType=[anti])
    LogicalTableScan(table=[[scott, DEPT]])
    LogicalTableScan(table=[[scott, EMP]]) {code}
Extend SemiJoinProjectTransposeRule to:
 # match both JoinRelType.SEMI and JoinRelType.ANTI;
 # preserve the original join type when creating the new LogicalJoin;
 # keep the existing behavior unchanged for SEMI.

 



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

Reply via email to