[
https://issues.apache.org/jira/browse/CALCITE-2295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu resolved CALCITE-2295.
----------------------------------
Fix Version/s: 1.39.0
Resolution: Fixed
This issue was resolved a long time ago.
The commit
https://github.com/apache/calcite/commit/2a89ec92becee9c9df61005f40407ba65cabd682
adds a test to enable us to close it.
Thank you for the commit [~nobigo]
Thank you for the review [~caicancai]
> Correlated SubQuery with Project will generate error plan
> ---------------------------------------------------------
>
> Key: CALCITE-2295
> URL: https://issues.apache.org/jira/browse/CALCITE-2295
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.15.0
> Reporter: godfrey he
> Priority: Critical
> Labels: pull-request-available
> Fix For: 1.39.0
>
>
> test case in *RelOptRulesTest.java*:
> {code:java}
> @Test public void testDecorrelateWithProject() throws Exception {
> final String sql = "select sal,\n"
> + "exists (select * from emp_b where emp.deptno =
> emp_b.deptno)\n"
> + "from sales.emp";
> checkSubQuery(sql).withLateDecorrelation(true).check();
> }
> {code}
> after *SqlToRelConverter*, the plan is
> {code:java}
> LogicalProject(SAL=[$5], EXPR$1=[EXISTS({
> LogicalFilter(condition=[=($cor0.DEPTNO, $7)])
> LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])
> })])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
> NOTES: *LogicalProject* does not have any *_variablesSet_* attributes.
> the correct plan should be:
> {code:java}
> LogicalProject(SAL=[$5], EXPR$1=[EXISTS({
> LogicalFilter(condition=[=($cor0.DEPTNO, $7)])
> LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])
> })], variablesSet=[[$cor0]])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)