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

Mihai Budiu resolved CALCITE-6833.
----------------------------------
    Fix Version/s: 1.39.0
       Resolution: Fixed

Fixed in 
https://github.com/apache/calcite/commit/91ec8d052924ba74ffdad4f0785477f7e1b6793a
Thank you for the contribution [~suibianwanwan33]
Thank you for the review [~nobigo]

> JDBC adapter generates invalid table alias for semi-join in UNION
> -----------------------------------------------------------------
>
>                 Key: CALCITE-6833
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6833
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.39.0
>
>
> Following CALCITE-5395, the test 
> [RelToSqlConverterTest.testUnionUnderSemiJoinNode|https://github.com/apache/calcite/blob/2ddfb0eb00bd87b040e4ca743a7451034dd28f98/core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java#L1783],
>   generates the following query, which is invalid.
> {code}
> SELECT "DEPTNO"
> FROM (SELECT *
>   FROM (SELECT *
>     FROM "scott"."EMP"
>     UNION ALL
>     SELECT *
>     FROM "scott"."EMP")
>   WHERE EXISTS (SELECT 1
>     FROM "scott"."DEPT"
>     WHERE "t"."DEPTNO" = "DEPT"."DEPTNO")) AS "t";
> {code}
> The query is invalid because the table alias "t" is used in a scope where it 
> is not visible. I suspect that {{AS "t"}} should be at the end of line 7, not 
> line 11.
> {{RelToSqlConverterTest}} correctly gives a validation error
> {noformat}
> From line 10, column 7 to line 10, column 9: Table 't' not found
> {noformat}
> Validation is only now enabled, during development of a fix for CALCITE-5529.



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

Reply via email to