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

duan xiong commented on CALCITE-4729:
-------------------------------------

[~julianhyde]  Hi. When I try to resolve this issue. I find some test code  
[Unit Test 
|https://github.com/apache/calcite/blob/master/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java#L694]
 And I noticed the Java doc about the "referencing columns from a sub-query 
that has duplicate column names is illegal". So I want to know whether we need 
to do this?  And In Calcite, I fund represent a column with a unique column 
name in scope. So If we decided to change this. I need some advice. Thank you 
very much.

Some UT(throw info:Column 'cust_id' is ambiguous)
{code:java}
select * from (select s.\"cust_id\", s.\"cust_id\"\n" + "from 
\"foodmart\".\"sales_fact_1997\" as s)
{code}

> Column in CTE should be ambiguous
> ---------------------------------
>
>                 Key: CALCITE-4729
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4729
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Lantao Jin
>            Assignee: duan xiong
>            Priority: Major
>
> {code}
> create table test (a int);
> with t as
> (
>   select * from test t1 join test t2 on t1.a=t2.a
> )
> select t.a from t;
> {code}
> The above query fails with 't.a' is ambiguous in Spark/Presto/Postgres. But 
> it succeeds in Calcite. Currently, many and many companies use Calcite as a 
> query federation layer upon multiple query engines such as Spark and Presto. 
> But this behavior confused users.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to