xiong duan created CALCITE-6469:
-----------------------------------

             Summary: Join on condition generates wrong plan when the condition 
is IN sub-query
                 Key: CALCITE-6469
                 URL: https://issues.apache.org/jira/browse/CALCITE-6469
             Project: Calcite
          Issue Type: Bug
    Affects Versions: 1.37.0
            Reporter: xiong duan
            Assignee: xiong duan
             Fix For: 1.38.0


Now Calcite will throw an exception when we execute the SQL:

 
{code:java}
select *  from scott.bonus b left join scott.emp e on e.deptno in (select 
deptno from scott.dept b){code}
I will try to rewrite this SQL become:

 
{code:java}
SELECT *
FROM "SCOTT"."BONUS"
LEFT JOIN ("SCOTT"."EMP" INNER JOIN (SELECT "DEPTNO"
FROM "SCOTT"."DEPT"
GROUP BY "DEPTNO") AS "t" ON "EMP"."DEPTNO" = "t"."DEPTNO") ON TRUE{code}
The SQL :
{code:java}
select *  from scott.emp e left join scott.bonus b on e.deptno in (select 
deptno from scott.dept b) {code}
I will try to rewrite this SQL become:
{code:java}
SELECT *
FROM "SCOTT"."EMP"
LEFT JOIN ("SCOTT"."BONUS" CROSS JOIN (SELECT "DEPTNO"
FROM "SCOTT"."DEPT"
GROUP BY "DEPTNO") AS "t") ON "EMP"."DEPTNO" = "t"."DEPTNO" {code}
 



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

Reply via email to