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

krooswu commented on CALCITE-7508:
----------------------------------

Hi @Haris Sattar,

I tried to reproduce the problem based on the description, but it seems to work 
as expected on my end (I tested with the latest {{main}} branch).

Could you please provide a minimal reproducible example, such as the exact SQL 
snippet, configuration, or a test case? That would help me investigate further. 
Thanks!

> RelToSqlConverter registers wrong alias for correlation variable in 
> visit(Project)
> ----------------------------------------------------------------------------------
>
>                 Key: CALCITE-7508
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7508
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.39.0
>            Reporter: Haris Sattar
>            Assignee: krooswu
>            Priority: Major
>              Labels: pull-request-available
>
> *Example:*
> Input RelNode tree: a correlated scalar subquery where the outer table is 
> table_a and the inner table is table_b, correlated on column "id".
> *Expected SQL output:*
> SELECT "id",
>   (SELECT SUM("value") FROM "table_b" AS "t1"
>    WHERE "id" = "t"."id") AS "total_value"
> FROM "table_a" AS "t"
> *Actual SQL output:*
> SELECT "id",
>   (SELECT SUM("value") FROM "table_b" AS "t1"
>    WHERE "id" = "t0"."id") AS "total_value"
> FROM "table_a" AS "t"
> The correlation reference emits "t0"."id" but the outer table's FROM clause 
> says AS "t". "t0" does not exist in the query. The SQL is invalid and will be 
> rejected by the execution engine.



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

Reply via email to