hive动态分区及中文

2021-01-28  本文已影响0人  JX907

错误一:
FAILED: SemanticException [Error 10096]: Dynamic partition strict mode requires at least one static partition column. To turn this off set hive.exec.dynamic.partition.mode=nonstrict

在hive-site.xml中设置:


image.png

错误二:
执行以下语句时报错(user_name为分区列)
insert overwrite table beian.analyze_ip partition(user_name) select
id,
address_purpose,
line_num,
'北京联通' as user_name
from beian.analyze_ip_tmp

原因:分区列内容不能为中文,修改hive元数据库的编码方式为utf后可以支持中文,执行以下语句:
alter database hive default character set utf8;
alter table PARTITIONS default character set utf8;
alter table PARTITION_KEY_VALS default character set utf8;
alter table SDS default character set utf8;
alter table PARTITIONS modify column PART_name varchar(190) character set utf8;
alter table PARTITION_KEY_VALS modify column PART_KEY_VAL varchar(256) character set utf8;
alter table SDS modify column LOCATION varchar(4000) character set utf8;

上一篇下一篇

猜你喜欢

热点阅读