You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Thomas Rebele (Jira)" <ji...@apache.org> on 2020/11/17 14:52:00 UTC
[jira] [Updated] (CALCITE-4404) Missing LogicalCorrelate when using
FILTER_SUB_QUERY_TO_CORRELATE for nested subqueries
[ https://issues.apache.org/jira/browse/CALCITE-4404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Rebele updated CALCITE-4404:
-----------------------------------
Attachment: Cte4404.java
> Missing LogicalCorrelate when using FILTER_SUB_QUERY_TO_CORRELATE for nested subqueries
> ---------------------------------------------------------------------------------------
>
> Key: CALCITE-4404
> URL: https://issues.apache.org/jira/browse/CALCITE-4404
> Project: Calcite
> Issue Type: Bug
> Reporter: Thomas Rebele
> Priority: Major
> Attachments: Cte4404.java
>
>
> The Programs#subQuery seem to not support nested subqueries.
> When applying the rule to the following plan
> {code}
> LogicalFilter(condition=[EXISTS({
> LogicalJoin(condition=[=($0, $5)], joinType=[left])
> LogicalFilter(condition=[=($cor0.empid, $0)])
> LogicalTableScan(table=[[hr, emps]])
> LogicalFilter(condition=[EXISTS({
> LogicalFilter(condition=[=($cor1.empid, $0)])
> LogicalTableScan(table=[[hr, emps]])
> })])
> LogicalTableScan(table=[[hr, emps]])
> })])
> LogicalTableScan(table=[[hr, emps]])
> {code}
> it gets transformed into
> {code}
> LogicalProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])
> LogicalJoin(condition=[true], joinType=[inner])
> LogicalTableScan(table=[[hr, emps]])
> LogicalAggregate(group=[{0}])
> LogicalProject(i=[true])
> LogicalJoin(condition=[=($0, $5)], joinType=[left])
> LogicalFilter(condition=[=($cor0.empid, $0)])
> LogicalTableScan(table=[[hr, emps]])
> LogicalProject(empid=[$0], deptno=[$1], name=[$2], salary=[$3], commission=[$4])
> LogicalCorrelate(correlation=[$cor1], joinType=[inner], requiredColumns=[{0}])
> LogicalTableScan(table=[[hr, emps]])
> LogicalAggregate(group=[{0}])
> LogicalProject(i=[true])
> LogicalFilter(condition=[=($cor1.empid, $0)])
> LogicalTableScan(table=[[hr, emps]])
> {code}
> The $cor0 has no associated LogicalCorrelate. My guess is that the first LogicalJoin should probably be a LogicalCorrelate.
> Please note that this is a minimal example. The plan has been obtained by simplifying a larger plan and _has no meaning by itself._
--
This message was sent by Atlassian Jira
(v8.3.4#803005)