[ 
https://issues.apache.org/jira/browse/CALCITE-3847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Danny Chen resolved CALCITE-3847.
---------------------------------
    Resolution: Fixed

Fixed in 
[8d4820f|https://github.com/apache/calcite/commit/8d4820f208cd69f4377fca175c8b83ff16b1a912]
 !

> 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
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.23.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to