[
https://issues.apache.org/jira/browse/CALCITE-6463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
shiji.mei updated CALCITE-6463:
-------------------------------
Description:
[dialect|#] is postgresql
original query:
SELECT MAX(distinct l_orderkey) FROM lineitem where exists( SELECT
MAX(c_custkey) FROM customer where c_custkey = l_orderkey GROUP BY c_custkey);
Rewritten query:
SELECT MAX("l_orderkey")
FROM "lineitem"
WHERE EXISTS (SELECT "c_custkey", MAX("c_custkey")
FROM "customer"
WHERE "c_custkey" = "lineitem12"."l_orderkey"
GROUP BY "c_custkey")
lineitem becomes lineitem12,and it will become a different number every time it
runs。
thank you !
was:
original query:
{code:java}
SELECT MAX(distinct l_orderkey) FROM lineitem where exists( SELECT
MAX(c_custkey) FROM customer where c_custkey = l_orderkey GROUP BY
c_custkey);{code}
Rewritten query:
{code:java}
SELECT MAX("l_orderkey")
FROM "lineitem"
WHERE EXISTS (SELECT "c_custkey", MAX("c_custkey")
FROM "customer"
WHERE "c_custkey" = "lineitem12"."l_orderkey"
GROUP BY "c_custkey"){code}
lineitem becomes lineitem12,and it will become a different number every time it
runs。
thank you !
> alias generation issue about correlated subquery handling
> ---------------------------------------------------------
>
> Key: CALCITE-6463
> URL: https://issues.apache.org/jira/browse/CALCITE-6463
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.37.0
> Reporter: shiji.mei
> Priority: Blocker
> Fix For: 1.38.0
>
>
> [dialect|#] is postgresql
> original query:
> SELECT MAX(distinct l_orderkey) FROM lineitem where exists( SELECT
> MAX(c_custkey) FROM customer where c_custkey = l_orderkey GROUP BY c_custkey);
> Rewritten query:
> SELECT MAX("l_orderkey")
> FROM "lineitem"
> WHERE EXISTS (SELECT "c_custkey", MAX("c_custkey")
> FROM "customer"
> WHERE "c_custkey" = "lineitem12"."l_orderkey"
> GROUP BY "c_custkey")
> lineitem becomes lineitem12,and it will become a different number every time
> it runs。
> thank you !
--
This message was sent by Atlassian Jira
(v8.20.10#820010)