hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "pengcheng xiong" <pxi...@hortonworks.com>
Subject Review Request 39872: expanding view doesn't quote reserved keyword
Date Mon, 02 Nov 2015 19:25:29 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39872/
-----------------------------------------------------------

Review request for hive and John Pullokkaran.


Repository: hive-git


Description
-------

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.


Diffs
-----

  ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java d2c3a7c 

Diff: https://reviews.apache.org/r/39872/diff/


Testing
-------


Thanks,

pengcheng xiong


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message