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");

你可能感兴趣的:(hive)