问题描述
我无法使用主键在蜂巢中创建外部表.以下是示例代码:
I am unable to create an external table in hive with primary key. Following is the example code:
hive> create table exmp((name string),primary key(name));
这将向我返回以下错误消息:
This returns me the following error message:
请帮帮我.
推荐答案
较旧版本的配置单元不支持主键,但此支持已在2.1.0版本的配置单元中添加.所以这是示例查询
Older version of the hive doesn't support primary key but this support has been added in 2.1.0 version of hive. So here is the sample query for it
CREATE TABLE table_name ( id int, name string, dept string, primary key(id) disable novalidate);
CREATE TABLE table_name ( id int, name string, dept string, primary key(id) disable novalidate);
PS:如何获取Hive版本
PS: How to get the version of hive
hive --version Hive 1.2.1000.x.x.x.xxxx-x
hive --version Hive 1.2.1000.x.x.x.xxxx-x
或进入直线并击中
beeline Beeline version 1.2.1000.x.x.x.xxxx-x by Apache Hive
beeline Beeline version 1.2.1000.x.x.x.xxxx-x by Apache Hive
这篇关于无法使用主键创建配置单元表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!