美文网首页
hive 建表报错:ParseException - canno

hive 建表报错:ParseException - canno

作者: 随时学丫 | 来源:发表于2019-02-11 17:49 被阅读3次

    hive 建表报错:ParseException - cannot recognize input near 'end' 'string'

    建表语句为

    CREATE EXTERNAL TABLE moveProjects (cid string, end string, category string)
    STORED BY 'org.apache.hadoop.hive.dynamodb.DynamoDBStorageHandler'
    TBLPROPERTIES ("dynamodb.table.name" = "Projects","dynamodb.column.mapping" = "cid:cid,end:end,category:category");
    

    报错

    NoViableAltException(88@[])at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.identifier(HiveParser_IdentifiersParser.java:9123)at org.apache.hadoop.hive.ql.parse.HiveParser.identifier(HiveParser.java:30750)...more stack trace...FAILED: ParseException line 1:77 cannot recognize input near 'end' 'string' ',' in column specification
    

    end 字段为 hive 保留字段,修改之后即可。如果非要用这个字段名,就用反引号改起来:

    CREATE EXTERNAL TABLE moveProjects (cid string, `end` string, category string) STORED BY 'org.apache.hadoop.hive.dynamodb.DynamoDBStorageHandler'
    TBLPROPERTIES ("dynamodb.table.name" = "Projects","dynamodb.column.mapping" = "cid:cid,end:end,category:category");
    

    参考:
    https://blog.csdn.net/u011940366/article/details/51396152

    相关文章

      网友评论

          本文标题:hive 建表报错:ParseException - canno

          本文链接:https://www.haomeiwen.com/subject/pjaqeqtx.html