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

Xuefu Zhang commented on HIVE-494:
----------------------------------

Pig supports this, though using $1, $2 syntax, which is useful and convenient 
in some sense. However, I didn't find it's in standard SQL. One downside of 
supporting this is that ordering starts to matter now in the select list. If I 
do "select a, b, c from T", the output is deterministic regardless T's schema 
(as long it has a, b, and c). On the other hand, if I do "select $1, $2, $3 
from T" and if later on the table's schema is changed as (a, b, d, c), then my 
query will return a different data set.

So, projecting by numbers is different from "they just get translated into 
numbers anyway".

Adding columns is quite common in hadoop data. Of course, one can argue that 
columns should always add at the end, which doesn't happen that way always.
                
> Select columns by index instead of name
> ---------------------------------------
>
>                 Key: HIVE-494
>                 URL: https://issues.apache.org/jira/browse/HIVE-494
>             Project: Hive
>          Issue Type: Wish
>          Components: Clients, Query Processor
>            Reporter: Adam Kramer
>            Priority: Minor
>              Labels: SQL
>         Attachments: ASF.LICENSE.NOT.GRANTED--HIVE-494.D1641.1.patch
>
>
> SELECT mytable[0], mytable[2] FROM some_table_name mytable;
> ...should return the first and third columns, respectively, from mytable 
> regardless of their column names.
> The need for "names" specifically is kind of silly when they just get 
> translated into numbers anyway.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to