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

Julian Hyde commented on CALCITE-1605:
--------------------------------------

It's possible, but not likely, because aggregation is different from windowed 
aggregation.

> Wrong result/plan for correlated subquery with windowing
> --------------------------------------------------------
>
>                 Key: CALCITE-1605
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1605
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Vineet Garg
>            Assignee: Julian Hyde
>            Priority: Major
>              Labels: sub-query
>
> Calcite produces wrong plan, hence wrong results for correlated subquery 
> which contains windowing function. 
> Query
> {code}select * from emps where empid-1 IN (select min(e.empid) over () from 
> emps e where e.empid =emps.empid); {code}
> Expected
> {code} 0 rows {code}
> Actual
> {noformat}
> +-------+------+--------+--------+------+-------+-----+---------+---------+----------+
> | EMPNO | NAME | DEPTNO | GENDER | CITY | EMPID | AGE | SLACKER | MANAGER | 
> JOINEDAT |
> +-------+------+--------+--------+------+-------+-----+---------+---------+----------+
> | 110   | John | 40     | M      | Vancouver | 2     | null | false   | true  
>   | 2002-05-03 |
> | 130   | Alice | 40     | F      | Vancouver | 2     | null | false   | true 
>    | 2007-01-01 |
> +-------+------+--------+--------+------+-------+-----+---------+---------+----------+
> {noformat}



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

Reply via email to