Maksim Zhuravkov created IGNITE-27403:
-----------------------------------------

             Summary: Sql. Investigate changes in CorrelatedSubqueryPlannerTest 
testCorrelatesCollisionsMixed after calcite 1.41
                 Key: IGNITE-27403
                 URL: https://issues.apache.org/jira/browse/IGNITE-27403
             Project: Ignite
          Issue Type: Improvement
          Components: sql ai3
            Reporter: Maksim Zhuravkov


Before calcite 1.41 there were 4 correlates in that test case now it is 2.

Original query:

{noformat}
SELECT * FROM t1 as cor WHERE 
EXISTS (SELECT 1 FROM t1 WHERE t1.b = (SELECT cor.a)) AND 
EXISTS (SELECT 1 FROM t1 WHERE t1.c = (SELECT cor.a))
{noformat}

The plan after applying transformations from 
PlannerPhase.HEP_SUBQUERIES_TO_CORRELATES

{noformat}
LogicalProject(A=[$0], B=[$1], C=[$2])
  LogicalProject(A=[$0], B=[$1], C=[$2], __PARTITION_ID=[$3], __PART=[$4], 
__part=[$5])
    LogicalCorrelate(correlation=[$cor0], joinType=[inner], 
requiredColumns=[{0}])
      LogicalCorrelate(correlation=[$cor0], joinType=[inner], 
requiredColumns=[{0}])
        LogicalTableScan(table=[[PUBLIC, T1]], tableId=[1])
        LogicalAggregate(group=[{0}])
          LogicalProject(i=[true])
            LogicalProject(A=[$0], B=[$1], C=[$2], __PARTITION_ID=[$3], 
__PART=[$4], __part=[$5])
              LogicalFilter(condition=[=($1, $6)])
                LogicalJoin(condition=[true], joinType=[left])
                  LogicalTableScan(table=[[PUBLIC, T1]], tableId=[1])
                  LogicalProject(A=[$cor0.A])
                    LogicalValues(tuples=[[{ 0 }]])
      LogicalAggregate(group=[{0}])
        LogicalProject(i=[true])
          LogicalProject(A=[$0], B=[$1], C=[$2], __PARTITION_ID=[$3], 
__PART=[$4], __part=[$5])
            LogicalFilter(condition=[=($2, $6)])
              LogicalJoin(condition=[true], joinType=[left])
                LogicalTableScan(table=[[PUBLIC, T1]], tableId=[1])
                LogicalProject(A=[$cor0.A])
                  LogicalValues(tuples=[[{ 0 }]])
{noformat}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to