You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Danny Chen (Jira)" <ji...@apache.org> on 2020/03/09 11:58:00 UTC
[jira] [Created] (CALCITE-3847) Decorrelation for join with lateral
table outputs wrong plan if the join condition contains correlation
variables
Danny Chen created CALCITE-3847:
-----------------------------------
Summary: Decorrelation for join with lateral table outputs wrong plan if the join condition contains correlation variables
Key: CALCITE-3847
URL: https://issues.apache.org/jira/browse/CALCITE-3847
Project: Calcite
Issue Type: Improvement
Components: core
Affects Versions: 1.22.0
Reporter: Danny Chen
Assignee: Danny Chen
Fix For: 1.23.0
After CALCITE-2004, we can decorrelate plan for query:
{code:sql}
select deptno, r.num from dept join
lateral table(ramp(dept.deptno)) as r(num)
on deptno=num
{code}
to plan like:
{code:xml}
LogicalProject(DEPTNO=[$0], NUM=[$2])
LogicalJoin(condition=[=($0, $2)], joinType=[inner])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
LogicalTableFunctionScan(invocation=[RAMP($cor0.DEPTNO)], rowType=[RecordType(INTEGER I)])
{code}
See there was a correlate variable left.
To fix this, i would suggest to stop decorrelating when we encounter the correlate variables in LogicalTableFunctionScan.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)