hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Lee (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-12156) expanding view doesn't quote reserved keyword
Date Wed, 14 Oct 2015 06:59:05 GMT

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

Jay Lee commented on HIVE-12156:
--------------------------------

I don't get it.

I have been using 2 or more levels of "dot" in my daily queries, how come it has NOT supportted
that yet? If this issue has nothing to do with reserved keywords, then why it will work if
I change the reserved keyword `end` to normal literal?

hive> create table testreserved (data struct<end_key:string, id: string>);
OK
Time taken: 0.556 seconds
hive> create view testreservedview as select data.end_key as data_end, data.id as data_id
from testreserved;
OK
Time taken: 0.678 seconds
hive> select data.end_key from testreserved;
OK
Time taken: 0.743 seconds
hive> select data_id from testreservedview;
OK
Time taken: 0.477 seconds
hive> select data_end from testreservedview;
OK
Time taken: 0.404 seconds

And the query example you suggested actually works:

hive> create table src (default struct<src:struct<key:string>, id: string>);
OK
Time taken: 0.27 seconds
hive> select default.src.key from src;
OK
Time taken: 0.274 seconds

> expanding view doesn't quote reserved keyword
> ---------------------------------------------
>
>                 Key: HIVE-12156
>                 URL: https://issues.apache.org/jira/browse/HIVE-12156
>             Project: Hive
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 1.2.1
>         Environment: hadoop 2.7
> hive 1.2.1
>            Reporter: Jay Lee
>
> hive> create table testreserved (data struct<`end`:string, id: string>);
> OK
> Time taken: 0.274 seconds
> hive> create view testreservedview as select data.`end` as data_end, data.id as data_id
from testreserved;
> OK
> Time taken: 0.769 seconds
> hive> select data.`end` from testreserved;
> OK
> Time taken: 1.852 seconds
> hive> select data_id from testreservedview;
> NoViableAltException(98@[])
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.identifier(HiveParser_IdentifiersParser.java:10858)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceFieldExpression(HiveParser_IdentifiersParser.java:6438)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnaryPrefixExpression(HiveParser_IdentifiersParser.java:6768)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceUnarySuffixExpression(HiveParser_IdentifiersParser.java:6828)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceBitwiseXorExpression(HiveParser_IdentifiersParser.java:7012)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceStarExpression(HiveParser_IdentifiersParser.java:7172)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedencePlusExpression(HiveParser_IdentifiersParser.java:7332)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceAmpersandExpression(HiveParser_IdentifiersParser.java:7483)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceBitwiseOrExpression(HiveParser_IdentifiersParser.java:7634)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceEqualExpression(HiveParser_IdentifiersParser.java:8164)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceNotExpression(HiveParser_IdentifiersParser.java:9177)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceAndExpression(HiveParser_IdentifiersParser.java:9296)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.precedenceOrExpression(HiveParser_IdentifiersParser.java:9455)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.expression(HiveParser_IdentifiersParser.java:6105)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser.expression(HiveParser.java:45840)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_SelectClauseParser.selectItem(HiveParser_SelectClauseParser.java:2907)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_SelectClauseParser.selectList(HiveParser_SelectClauseParser.java:1373)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser_SelectClauseParser.selectClause(HiveParser_SelectClauseParser.java:1128)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser.selectClause(HiveParser.java:45827)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser.selectStatement(HiveParser.java:41495)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:41402)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:40413)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:40283)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1590)
> 	at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1109)
> 	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
> ...
> FAILED: SemanticException line 1:29 cannot recognize input near 'end' 'as' 'data_end'
in expression specification in definition of VIEW testreservedview [
> select `testreserved`.`data`.end as `data_end`, `testreserved`.`data`.id as `data_id`
from `test`.`testreserved`
> ] used as testreservedview at Line 1:20
> When view is expanded, field should be quote with backquote.



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

Mime
View raw message