hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dudu Markovitz (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (HIVE-10120) Disallow create table with dot/colon in column name
Date Sun, 07 May 2017 08:50:04 GMT

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

Dudu Markovitz edited comment on HIVE-10120 at 5/7/17 8:49 AM:
---------------------------------------------------------------

1. 
I'm truly puzzled here.
Why put a limitation on the *create* statement instead of removing the limitation from the
*select* statement?
There seems to be no logical reason to prohibit queries such as *select `a.b.c`*.

2.
A)
*CTAS* was not handled and it still possible to create tables that cannot be queried

{code}
hive> create table t as select 1 as `a.b.c`;
OK
hive> desc t;
OK
col_name    data_type   comment
a.b.c                   int                                         
Time taken: 0.441 seconds, Fetched: 1 row(s)
hive> select * from t;
FAILED: RuntimeException java.lang.RuntimeException: cannot find field a from [0:a.b.c]
{code}

B)
*alter table ... change column* was not handled and it still possible to rename a column to
unqueryable name.

{code}
create table t (i int);
alter table t change column i `a.b.c` int
select * from t;

Error while compiling statement: FAILED: RuntimeException java.lang.RuntimeException: cannot
find field a from [0:a.b.c]
{code}


was (Author: dmarkovitz):
1. 
I'm truly puzzled here.
Why put a limitation on the *create* statement instead of removing the limitation from the
*select* statement?
There seems to be no logical reason to prohibit queries such as *select `a.b.c`*.

2.
*CTAS* was not handled and it still possible to create tables that cannot be queried

{code}
hive> create table t as select 1 as `a.b.c`;
OK
hive> desc t;
OK
col_name    data_type   comment
a.b.c                   int                                         
Time taken: 0.441 seconds, Fetched: 1 row(s)
hive> select * from t;
FAILED: RuntimeException java.lang.RuntimeException: cannot find field a from [0:a.b.c]
{code}

> Disallow create table with dot/colon in column name
> ---------------------------------------------------
>
>                 Key: HIVE-10120
>                 URL: https://issues.apache.org/jira/browse/HIVE-10120
>             Project: Hive
>          Issue Type: Improvement
>          Components: Parser
>            Reporter: Pengcheng Xiong
>            Assignee: Pengcheng Xiong
>              Labels: TODOC1.2
>             Fix For: 1.2.0
>
>         Attachments: HIVE-10120.01.patch, HIVE-10120.02.patch
>
>
> Since we don't allow users to query column names with dot in the middle such as emp.no,
don't allow users to create tables with such columns that cannot be queried. Fix the documentation
to reflect this fix.
> Here is an example. Consider this table:
> {code}
> CREATE TABLE a (`emp.no` string);
> select `emp.no` from a; fails with this message:
> FAILED: RuntimeException java.lang.RuntimeException: cannot find field emp from [0:emp.no]
> {code}
> The hive documentation needs to be fixed:
> {code}
>  (https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL) seems to  indicate
that any Unicode character can go between the backticks in the select statement, but it doesn’t
like the dot/colon or even select * when there is a column that has a dot/colon. 
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message