git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (CALCITE-2295) Correlated SubQuery with Project will generate error plan


godfrey he created CALCITE-2295:
-----------------------------------

             Summary: 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
            Assignee: Julian Hyde


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
(v7.6.3#76005)



( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-calcite-development/msg03382.html on line 118
Call Stack
#TimeMemoryFunctionLocation
10.0006364728{main}( ).../msg03382.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-calcite-development/msg03382.html on line 118
Call Stack
#TimeMemoryFunctionLocation
10.0006364728{main}( ).../msg03382.html:0