Hive field Chinese Note garbled solution

Chinese garbled characters in Hive fields. For example, when show create table xxx is executed, garbled characters are found in table-level comments and field-level comments (both????), which are generally caused by improper configuration of the hive metabase of.

At this time, you can perform configuration adjustments as follows:

Log in to hive’s meta-database mysql: (not executed in the hive sql environment )

1. Set the hive metabase character set

show create database hive;< /em>

View as utf8, need to be changed to latin1

alter database hive character set latin1; (see also)

2, change the following table fields to the character set encoding to utf8

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;

As you can see, the following statements adjust the characters for the fields that may appear in Chinese, table parameters, partition settings, and index parameters. Set encoding.

Leave a Comment

Your email address will not be published.