You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Haisheng Yuan (JIRA)" <ji...@apache.org> on 2019/06/17 22:52:00 UTC
[jira] [Updated] (CALCITE-3132) Simply expressions in LogicalFilter
generated for subqueries with quantified predicate
[ https://issues.apache.org/jira/browse/CALCITE-3132?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Haisheng Yuan updated CALCITE-3132:
-----------------------------------
Labels: sub-query (was: )
> Simply expressions in LogicalFilter generated for subqueries with quantified predicate
> --------------------------------------------------------------------------------------
>
> Key: CALCITE-3132
> URL: https://issues.apache.org/jira/browse/CALCITE-3132
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Vineet Garg
> Assignee: Vineet Garg
> Priority: Major
> Labels: sub-query
>
> Following test in RelOptRulesTest generate plan with LogicalFilter
> {code}
> @Test public void testSome() {
> final String sql = "select * from emp e1\n"
> + " where e1.empno > SOME (select deptno from dept)";
> checkSubQuery(sql).withLateDecorrelation(true).check();
> }
> {code}
> {code}
> LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
> LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
> LogicalFilter(condition=[OR(AND(IS TRUE(>($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(>($0, $9))), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))])
> LogicalJoin(condition=[true], joinType=[inner])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()], d=[COUNT($0)])
> LogicalProject(DEPTNO=[$0])
> LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
> {code}
> Note that LogicalFilter has condition which should be further simplified
> {code}
> (condition=[OR(AND(IS TRUE(>($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(>($0, $9))), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))])
> {code}
> If {{AND(IS TRUE(>($0, $9)), <>($10, 0))}} is true so will be {{AND(IS TRUE(>($0, $9)), <>($10, 0))}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)