[
https://issues.apache.org/jira/browse/CALCITE-7508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18093844#comment-18093844
]
krooswu commented on CALCITE-7508:
----------------------------------
Hi, while working on this issue, I tried your test after reverting the code
changes, and it still passes. It looks like the test doesn't actually fail
before the fix, so it may not be reproducing the original bug. Just wanted to
share the observation.
> 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)