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)