开源 Hive 无法支持中文字段名和中文分区。如果您有中文字段名的需求,可以修改元数据库。如下是修改元数据库的 语句:
-- 添加中文分区 ALTER TABLE `PARTITIONS` CHANGE `PART_NAME` `PART_NAME` varchar(767) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL; -- 添加中文分区,且分区字段为中文字段 ALTER TABLE `PARTITION_KEYS` CHANGE `PKEY_NAME` `PKEY_NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL; alter table `PARTITION_KEY_VALS` CHANGE `PART_KEY_VAL` `PART_KEY_VAL` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL; -- 添加中文字段 ALTER TABLE `COLUMNS_V2` CHANGE `COMMENT` `COMMENT` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL; ALTER TABLE `COLUMNS_V2` CHANGE `COLUMN_NAME` `COLUMN_NAME` varchar(767) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL; ALTER TABLE `COLUMNS_V2` CHANGE `TYPE_NAME` `TYPE_NAME` mediumtext CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL; -- 支持视图中文 ALTER TABLE TBLS CHANGE VIEW_ORIGINAL_TEXT VIEW_ORIGINAL_TEXT mediumtext CHARACTER SETutf8 collate utf8_bin ; ALTER TABLE TBLS CHANGE VIEW_EXPANDED_TEXT VIEW_EXPANDED_TEXT mediumtext CHARACTER SETutf8 collate utf8_bin ;