This is an automated email from the ASF dual-hosted git repository. yuqi4733 pushed a commit to branch fix_charset_problem in repository https://gitbox.apache.org/repos/asf/gravitino.git
commit 779ed84e366ae320b98e72b4dc44593bae243e08 Author: yuqi <y...@datastrato.com> AuthorDate: Thu Mar 6 15:02:02 2025 +0800 fix --- dev/docker/hive/start.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dev/docker/hive/start.sh b/dev/docker/hive/start.sh index ca5698faa6..1ddbf720cf 100644 --- a/dev/docker/hive/start.sh +++ b/dev/docker/hive/start.sh @@ -69,6 +69,8 @@ if [[ -n "$SERVICE_ACCOUNT_FILE" ]]; then sed -i "s|SERVICE_ACCOUNT_FILE|${SERVICE_ACCOUNT_FILE}|g" ${HIVE_CONF_DIR}/hive-site.xml fi +sed -i "s/useSSL=false/useSSL=false&characterEncoding=utf8&useUnicode=true/g" ${HIVE_CONF_DIR}/hive-site.xml + # Link mysql-connector-java after deciding where HIVE_HOME symbolic link points to. ln -s /opt/mysql-connector-java-${MYSQL_JDBC_DRIVER_VERSION}/mysql-connector-java-${MYSQL_JDBC_DRIVER_VERSION}.jar ${HIVE_HOME}/lib @@ -165,6 +167,14 @@ echo """ CREATE DATABASE hive; """ | mysql --user=root --password=${MYSQL_PWD} + +# change charset + +set -i 's/CHARACTER SET latin1 COLLATE latin1_bin/CHARACTER SET utf8mb4 COLLATE utf8mb4_bin/g' ${HIVE_HOME}/scripts/metastore/upgrade/mysql/hive-schema-2.3.0.mysql.sql +set -i 's/CHARSET=latin1/CHARSET=utf8/g' ${HIVE_HOME}/scripts/metastore/upgrade/mysql/hive-schema-2.3.0.mysql.sql +set -i 's/varchar(4000)/text/g' ${HIVE_HOME}/scripts/metastore/upgrade/mysql/hive-schema-2.3.0.mysql.sql +set -i 's/varchar(767)/text/g' ${HIVE_HOME}/scripts/metastore/upgrade/mysql/hive-schema-2.3.0.mysql.sql + # start hive echo "Starting Hive..." ${HIVE_HOME}/bin/schematool -initSchema -dbType mysql