You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Sheng Wang (Jira)" <ji...@apache.org> on 2021/11/24 12:12:00 UTC
[jira] [Created] (IMPALA-11036) CTAS throw AnalysisException Duplicate column name when subquery contains same query without alias
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: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org