0

以下 HQL 在 HDP 2.6.1 和 Hive 1.2.1000 上生成错误。是直线问题还是 Hive 版本?

CREATE EXTERNAL TABLE IF NOT EXISTS `nwdb.strings` (`string_id` INT, `string_data` STRING, PRIMARY KEY(string_id) DISABLE NOVALIDATE) ROW FORMAT DELIMITED FIELDS TERMINATED BY "," LINES TERMINATED BY "\n" STORED AS TEXTFILE LOCATION "/data/nwdb/";

错误

Error: Error while compiling statement: FAILED: ParseException line 1:133 cannot recognize input near 'KEY' '(' 'string_id' in column type (state=42000,code=40000)

甚至 ALTER 命令也会给出相同的错误

ALTER TABLE `aravind_stg_platform_nw_northwind_nwdb.strings` ADD CONSTRAINT string_id_PK PRIMARY KEY (`string_id`);
4

1 回答 1

2

似乎对主键和外键的支持来自 Hive 2.1

https://issues.apache.org/jira/browse/HIVE-13290

于 2017-10-13T02:42:24.890 回答