Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-12156

expanding view doesn't quote reserved keyword

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 2.0.0
    • Component/s: Parser
    • Labels:
      None
    • Environment:

      hadoop 2.7
      hive 1.2.1

    • Target Version/s:

      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.

        Attachments

        1. HIVE-12156.01.patch
          9 kB
          Pengcheng Xiong
        2. HIVE-12156.02.patch
          3 kB
          Pengcheng Xiong
        3. HIVE-12156.03.patch
          9 kB
          Pengcheng Xiong

          Issue Links

            Activity

              People

              • Assignee:
                pxiong Pengcheng Xiong
                Reporter:
                busyjay Jay Lee
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: