shiji.mei created CALCITE-6463:
----------------------------------

             Summary: 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
             Fix For: 1.38.0


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)

Reply via email to