hive表注释中文乱码问题
程序员文章站
2022-06-26 08:46:56
...
1.修改hive存储在mysql里的元数据相关信息
a. 修改字段注释字符集
alter table COLUMNS_V2 modify columnCOMMENT varchar(256) character set utf8;
b. 修改表注释字符集
alter table TABLE_PARAMS modifycolumn PARAM_VALUE varchar(4000) character set utf8;
c. 修改分区表参数,以支持分区键能够用中文表示
alter table PARTITION_PARAMS modifycolumn PARAM_VALUE varchar(4000) character set utf8;
alter table PARTITION_KEYS modifycolumn PKEY_COMMENT varchar(4000) character set utf8;
d. 修改索引注解
alter table INDEX_PARAMS modifycolumn PARAM_VALUE varchar(4000) character set utf8;
- 修改hive-site.xml
vi hive-site.xml
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://IP:3306/hive?useSSL=false&createDatabaseIfNotExist=true&characterEncoding=UTF-8</value>
</property>
- 重建表结构