In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you the "Hive table field Comment Chinese garbled code how to do", the content is easy to understand, clear, hope to help you solve doubts, the following let Xiaobian lead you to study and learn "Hive table field Comment Chinese garbled how to do" this article.
1. Problem description
When you create a table with Chinese comments in the default Hive, the comment will appear garbled in both Hive CLI and Hue. If you use the following table statement:
Create external table test_table (S1 string comment 'abc',s2 string comment' Hello') row format delimited fields terminated by'# 'stored as textfile location' / lilei/test_table'
View it in Hive CLI as follows:
The same is shown in Hue, omitted here.
two。 Solution.
This problem is caused by the COMMENT encoding of the field in the Metabase table COLUMNS_V2 in mysql, which needs to be set to utf-8, as shown below:
Set the encoding of this field to utf-8 in mysql, as follows:
| | mysql-u root-puse metastore;alter table COLUMNS_V2 modify column COMMENT varchar (256) character set utf8;FLUSH PRIVILEGES; | |
| |:-|
Note that utf-8 metadata should be used to create this database, such as create database metastore defaultcharacter set utf8
Go back to Hive and recreate a table of create
View the comments for the table:
It is found that the Chinese comments have been displayed normally.
View the previous table:
It is still found to be garbled.
You need to modify the comment of the previous table to display normally, execute it in Hive CLI, and the command is as follows:
| | ALTER TABLE test_table1 change column S2 S2 STRING COMMENT'I'm not fine'; |
| |:-|
Look at the comment of the old table again:
It is found that the Chinese comments have been displayed normally. Problem solved.
The above is all the contents of the article "what to do about Chinese garbled codes in Hive table field Comment". Thank you for your reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.