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

Sheng Wang commented on IMPALA-11036:
-------------------------------------

Hi [~stigahuang] and [~boroknagyz], is it designed like this deliberately or 
just a bug?

> CTAS throw AnalysisException Duplicate column name when subquery contains 
> same query without alias
> --------------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-11036
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11036
>             Project: IMPALA
>          Issue Type: Question
>            Reporter: Sheng Wang
>            Priority: Minor
>
> Hi, recently I found that CTAS will throw AnalysisException Duplicate column 
> name when subquery contains same query without alias like this:
> {code:java}
> create table t3 as select * from (select ds,c1 from t1 ) t1 join (select 
> ds,c2 from t2 ) t2 on t1.ds=t2.ds;
> {code}
> Even if we use 't1.ds' and 't2.ds', also same exception, unless we use alias 
> in subquery, such as 'ds as t1_ds' and 'ds as t2_ds'. The main reason is when 
> get 'colLabels_' in SelectStmt, Impala get column label like this: 
> {code:java}
>   public String toColumnLabel(int selectListPos, boolean useHiveColLabels) {
>     if (alias_ != null) return alias_.toLowerCase();
>     if (expr_ instanceof SlotRef) {
>       SlotRef slotRef = (SlotRef) expr_;
>       return Joiner.on(".").join(slotRef.getResolvedPath().getRawPath());
>     }
>     ......
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to