impala和hive建表注释出现乱码
impala和hive建表注释出现乱码:
Query: describe xxxx
+--------------------+--------------+----------------------------------------+
| name | type | comment |
+--------------------+--------------+----------------------------------------+
| id | varchar(64) | ?? |
| channel | varchar(30) | ?????? |
| deery_sign | varchar(64) | ??????(???) |
| user_bae_id | varchar(64) | ????id |
| id_typ | varchar(10) | ??????? |
| id_no | varchar(30) | ??????? |
| cust_nme | varchar(60) | ????? |
| goods_no | varchar(30) | ???? |
| goods_sns_no | varchar(40) | ?????? |
| goods_ame | varchar(100) | ???? |
| coopr_de | varchar(42) | ?????? |
| coopr_nme | varchar(300) | ?????? |
| lib_tye | varchar(2) | ???? 01-??? 02-??????? 03-???? 04-??? |
| lib_time | varchar(45) | ???? |
| out_copr_cde | varchar(42) | ?????? |
| dt | varchar(8) | |
+--------------------+--------------+----------------------------------------+
创建表后,用desc 在hive中查看表信息,注释显示乱码。解决方案如下:
1 进入mysql ,执行
show create database hive
- 1
- 1
查看hive 数据库当前编码,如果是utf8 则执行下面sql
alter database hive default character set latin1
- 1
- 1
将 hive 数据库默认编码改成 latin1
2 执行下面sql ,修改表
use hive;
alter table COLUMNS_V2 modify column COMMENT varchar(256) character set utf8;
alter table TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
alter table PARTITION_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
alter table PARTITION_KEYS modify column PKEY_COMMENT varchar(4000) character set utf8;
alter table INDEX_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
上一篇: 蒙特卡洛算法
下一篇: MySQL5.7的安装历程
推荐阅读