Skip to content

Commit 0e41493

Browse files
authored
[#6612] fix(hive-image): Support Chinese in database, table and column commens for Hive catalog (#6625)
### What changes were proposed in this pull request? Modify the table structure of the MySQL table for the Hive metastore ### Why are the changes needed? The default chaset `latin1` does not support Chinese. Fix: #6612 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? <img width="1409" alt="image" src="https://github.com/user-attachments/assets/531d08b8-6f19-4a27-888f-8ed101a36b08" /> <img width="1214" alt="image" src="https://github.com/user-attachments/assets/d16c5257-b763-4efc-9246-c590a0874548" /> <img width="1393" alt="image" src="https://github.com/user-attachments/assets/0c5c9abb-8394-408f-81d8-9cf8bd43f240" />
1 parent 0c9f581 commit 0e41493

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

dev/docker/hive/start.sh

+12
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ if [[ -n "$SERVICE_ACCOUNT_FILE" ]]; then
6969
sed -i "s|SERVICE_ACCOUNT_FILE|${SERVICE_ACCOUNT_FILE}|g" ${HIVE_CONF_DIR}/hive-site.xml
7070
fi
7171

72+
sed -i "s/useSSL=false/useSSL=false\&amp;characterEncoding=utf8\&amp;useUnicode=true/g" ${HIVE_CONF_DIR}/hive-site.xml
73+
7274
# Link mysql-connector-java after deciding where HIVE_HOME symbolic link points to.
7375
ln -s /opt/mysql-connector-java-${MYSQL_JDBC_DRIVER_VERSION}/mysql-connector-java-${MYSQL_JDBC_DRIVER_VERSION}.jar ${HIVE_HOME}/lib
7476

@@ -168,6 +170,16 @@ echo """
168170
# start hive
169171
echo "Starting Hive..."
170172
${HIVE_HOME}/bin/schematool -initSchema -dbType mysql
173+
echo """
174+
alter table DBS modify column \`DESC\` varchar(4000) character set utf8mb4 collate utf8mb4_bin;
175+
alter table COLUMNS_V2 modify column COMMENT varchar(256) character set utf8mb4 collate utf8mb4_bin;
176+
alter table TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8mb4 collate utf8mb4_bin;
177+
alter table PARTITION_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8mb4 collate utf8mb4_bin;
178+
alter table PARTITION_KEYS modify column PKEY_COMMENT varchar(4000) character set utf8mb4 collate utf8mb4_bin;
179+
alter table INDEX_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8mb4 collate utf8mb4_bin;
180+
alter table PARTITIONS modify column PART_NAME varchar(757) character set utf8mb4 collate utf8mb4_bin;
181+
""" | mysql --user=root --password=${MYSQL_PWD} -Dmetastore_db
182+
171183
${HIVE_HOME}/bin/hive --service hiveserver2 > /dev/null 2>&1 &
172184
${HIVE_HOME}/bin/hive --service metastore > /dev/null 2>&1 &
173185

0 commit comments

Comments
 (0)