Hive table comment Chinese garbled problem

1. Modify the metadata related information stored in hive in mysql

a. Modify the field comment character set

alter table COLUMNS_V2 modify columnCOMMENT varchar(256) character set utf8;

b. Modify the table comment character set

alter table TABLE_PARAMS modifycolumn PARAM_VALUE varchar(4000) character set utf8;

c. Modify the partition table parameters to support the partition key can be expressed in Chinese

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. Modify index annotations

alter table INDEX_PARAMS modifycolumn PARAM_VALUE varchar(4000) character set utf8;

  1. Modify hive-site.xml

vi hive-site.xml

<property>

   <name>javax.jdo.option.ConnectionURL</name>

   <value>jdbc:mysql://IP:3306/hive?useSSL=false&amp;createDatabaseIfNotExist=true&amp;characterEncoding=UTF-8</value>
   
</property>
  1. Rebuild the table structure

Guess you like

Origin blog.csdn.net/w13716207404/article/details/103324036