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

Weihua Zhang commented on CALCITE-7882:
---------------------------------------

*rewriting one sub-query destroys the correlation-variable scope that the 
remaining sub-queries depend on.*

> JOIN ON condition with an uncorrelated sub-query followed by a correlated 
> EXISTS fails with "Unable to implement"
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7882
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7882
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.42.0
>            Reporter: Mihai Budiu
>            Assignee: Weihua Zhang
>            Priority: Major
>              Labels: pull-request-available
>
> Here is the expected output as a quidem test:
> {code}
> !use scott
> !set outputformat mysql
> select e.ename
> from emp as e join dept as d
> on e.deptno = d.deptno
>   and e.sal < (select max(s.sal) from emp as s)
>   and exists (select 1 from emp as s where s.mgr = e.empno)
> order by e.ename;
> +-------+
> | ENAME |
> +-------+
> | BLAKE |
> | CLARK |
> | FORD  |
> | JONES |
> | SCOTT |
> +-------+
> (5 rows)
> {code}
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to