[ 
https://issues.apache.org/jira/browse/CALCITE-7382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Silun Dong resolved CALCITE-7382.
---------------------------------
    Fix Version/s: 1.42.0
       Resolution: Fixed

Fixed in 
[https://github.com/apache/calcite/commit/270ba649cfa80228d3f4f6635a08ab06de504399]

Thank you for your reviews [~rubenql] , [~asolimando] and [~jensen] 

> The TopDownGeneralDecorrelator returns an error result when a subquery 
> contains a LIMIT 1
> -----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7382
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7382
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Zhen Chen
>            Assignee: Silun Dong
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.42.0
>
>
> The following are the correct results.
> {code:java}
> !use scott
> SELECT dname, (SELECT emp.comm FROM "scott".emp where dept.deptno = 
> emp.deptno ORDER BY emp.comm limit 1) FROM "scott".dept;
> +------------+--------+
> | DNAME      | EXPR$1 |
> +------------+--------+
> | ACCOUNTING |        |
> | OPERATIONS |        |
> | RESEARCH   |        |
> | SALES      |   0.00 |
> +------------+--------+
> (4 rows)
> !ok {code}
> However, TopDownGeneralDecorrelator yielded the following result.
> {code:java}
> !use scott
> SELECT dname, (SELECT emp.comm FROM "scott".emp where dept.deptno = 
> emp.deptno ORDER BY emp.comm limit 1) FROM "scott".dept;
> +------------+---------+
> | DNAME      | EXPR$1  |
> +------------+---------+
> | ACCOUNTING |         |
> | ACCOUNTING |         |
> | ACCOUNTING |         |
> | OPERATIONS |         |
> | RESEARCH   |         |
> | RESEARCH   |         |
> | RESEARCH   |         |
> | RESEARCH   |         |
> | RESEARCH   |         |
> | SALES      |    0.00 |
> | SALES      | 1400.00 |
> | SALES      |  300.00 |
> | SALES      |  500.00 |
> | SALES      |         |
> | SALES      |         |
> +------------+---------+
> (15 rows)
> !ok {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to