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

Ashutosh Chauhan commented on HIVE-14158:
-----------------------------------------

Choice of using _c1, _c2 and so on for unnamed columns looked little 
unintuitive to me, so I did little experimentation.

I tried following on mysql:
{code}
create table t1 (a int, b char(10));
insert into t1 values(10, 'fg');
create view v1 as select a,10,10 from t1;
describe v1;
COLUMN_NAME     
a
10
My_exp_10
{code}
and then tried following on postgres
{code}
create table t1 (a int, b char(10));
insert into t1 values(10, 'fg');
create view v1 as select a,10,20 as a2 from t1;
drop view v1;
create view v1 as select a,10,20 from t1;
ERROR: column "?column?" specified more than once
{code}

>From above it seems mysql uses column's constant value as column name until 
>there is a collision and then picks name as per its own convention. Postgres 
>uses '?column?' as column name and then throws exception when there are 
>multiple unnamed columns. So, choice of _cN by Hive doesn't look that 
>arbitrary given what others are doing : )  I don't have oracle handy. 
>Pengcheng, can you see what Oracle does in this case. 

> deal with derived column names
> ------------------------------
>
>                 Key: HIVE-14158
>                 URL: https://issues.apache.org/jira/browse/HIVE-14158
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Security
>            Reporter: Pengcheng Xiong
>            Assignee: Pengcheng Xiong
>             Fix For: 2.1.0
>
>         Attachments: HIVE-14158.01.patch, HIVE-14158.02.patch, 
> HIVE-14158.03.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to