[ 
https://issues.apache.org/jira/browse/CALCITE-1726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16763306#comment-16763306
 ] 

Vineet Garg commented on CALCITE-1726:
--------------------------------------

Created a pull request to fix this at 
[https://github.com/apache/calcite/pull/1035]

[~julianhyde] [~jcamachorodriguez] Would you mind taking a look?

 

> Subquery in FILTER is left untransformed 
> -----------------------------------------
>
>                 Key: CALCITE-1726
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1726
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Vineet Garg
>            Assignee: Julian Hyde
>            Priority: Major
>              Labels: pull-request-available, sub-query
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Reproducer
> Query:
> {code:SQL}
> select * from emp 
>   where empno IN (select (select max(sal) from emp) from dept)
> {code}
> Plan after {{SubqueryRemoveRule}}
> {code:SQL}
> 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])
>     LogicalJoin(condition=[=($0, $9)], joinType=[inner])
>       LogicalTableScan(table=[[CATALOG, SALES, EMP]])
>       LogicalAggregate(group=[{0}])
>         LogicalProject(EXPR$0=[$SCALAR_QUERY({
> LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])
>   LogicalProject(SAL=[$5])
>     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> })])
>           LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
> {code}
> As you can notice scalar query in LogicalProject is left as it is



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to