【发布时间】:2021-04-26 18:37:50
【问题描述】:
我需要在 unicode 分隔文件上创建一个 hive 表(unicode 字符 - ."\uFFFD",替换字符)
为此,我们将 hive 作业提交到集群。 使用 ROW FORMAT Delimited 尝试使用 Lazy simple serde -
gcloud dataproc 作业提交 hive --cluster --region --执行“创建外部表 hiveuni_test_01(代码 字符串,telephone_num 字符串,finding_name 字符串,给定名称 字符串,alt_finding_name 字符串,house_num 字符串,street_name 字符串,地区字符串,状态字符串,保留字符串,zip_code 字符串,directive_text 字符串,special_listing_text 字符串,id 字符串,纬度字符串,经度字符串,rboc_sent_date 字符串) ROW 以 '\uFFFD' 终止的格式分隔字段 '\n' 存储为文本文件位置 'gs://hive-idaas-dev-warehouse/datasets/unicode_file';"
但这并不能正确创建表格,整行只放在第一列。
我们使用云 SQL mysql 服务器作为 hive 元存储,检查 mysql 也有 utf8 编码。
尝试使用 multidelimitserde -
gcloud dataproc 作业提交 hive --cluster dev-sm-35cb3516-ed82-4ec2-bf0d-89bd7e0e60f0 --region us-central1 --jars gs://hive-idaas-dev-warehouse/hive-jar/hive-contrib-0.14.0.jar --execute "创建外部表 hiveuni_test_05 (codes string,telephone_num string,finding_name string,given_name 字符串,alt_finding_name 字符串,house_num 字符串,street_name 字符串,位置字符串,状态字符串,保留字符串,zip_code 字符串,directive_text 字符串,special_listing_text 字符串,id 字符串,纬度字符串,经度字符串,rboc_sent_date 字符串) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.MultiDelimitSerDe' WITH SERDEPROPERTIES ('field.delim'='\uFFFD') 存储为输入格式 'org.apache.hadoop.mapred.TextInputFormat' 输出格式 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' 位置 'gs://hive-idaas-dev-warehouse/datasets/unicode_file';"
这给出了一个例外 - java.lang.ClassNotFoundException: Class org.apache.hadoop.hive.serde2.MultiDelimitSerDe not found
我在集群启动期间放置了一个初始化脚本,它将包含org.apache.hadoop.hive.serde2.MultiDelimitSerDe 类的hive-contrib-0.14.0.jar 放在/usr/lib/hadoop/lib/ 中。我看到 jar 通过对集群执行 ssh 放置在文件夹中。
有没有办法在创建表时通过 hive 客户端读取 unicode 字符,或者为什么即使将 jar 放入 hadoop lib 目录后我仍然会收到错误 classNotFound?
【问题讨论】:
标签: java hadoop unicode hive google-cloud-dataproc