Sheng Wang created IMPALA-11036:
-----------------------------------
Summary: 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
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: [email protected]
For additional commands, e-mail: [email protected]