hive 支持中文注释

1.1        修改Hive支持中文注释

  1. 修改hive-site.xml中的参数

[atguigu@hadoop102 conf]$ vim hive-site.xml

<property>

<name>javax.jdo.option.ConnectionURL</name>     <value>jdbc:mysql://hadoop102:3306/metastore?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=UTF-8

</value>

<description>JDBC connect string for a JDBC metastore</description>

</property>

  1. 进入数据库 Metastore 中执行以下 SQL 语句 

(1)修改表字段注解和表注解:

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;

(2)修改分区字段注解:

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;

  1. 测试:

hive (default)> create table student(id int COMMENT '学生ID', name string COMMENT '

学生姓名')

              > COMMENT '学生表'

              > PARTITIONED BY ( `date` string COMMENT '日期')

              > row format delimited

              > fields terminated by '\t';

desc formatted student;

查看是否能够正常显示中文

posted @ 2021-08-13 14:50  monkey66  阅读(124)  评论(0编辑  收藏  举报