我试图在hive中将日志数据解析为镶木地板文件格式,使用的分隔符是" || - ||"。 样本行是 " b8905bfc-dc34-463e-a6ac-879e50c2e630 || - || || syntrans1 - || CitBook"
执行数据分段后,我可以得到结果
" b8905bfc-dc34-463e-a6ac-879e50c2e630 syntrans1 CitBook"。
将数据转换为镶木地板文件格式时出错: `
Caused by: java.lang.ClassNotFoundException: Class org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2185)
at org.apache.hadoop.hive.ql.plan.PartitionDesc.getDeserializer(PartitionDesc.java:137)
at org.apache.hadoop.hive.ql.exec.MapOperator.getConvertedOI(MapOperator.java:297)
... 24 more
This is what I have tried
create table log (a String ,b String ,c String)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.MultiDelimitSerDe'
WITH SERDEPROPERTIES (
"field.delim"="||-||",
"collection.delim"="-",
"mapkey.delim"="@"
);
create table log_par(
a String ,
b String ,
c String
) stored as PARQUET ;
insert into logspar select * from log_par ;
`
答案 0 :(得分:1)
Aman kumar,
要解决此问题,请在添加以下jar后运行配置单元查询:
hive> add jar hive-contrib.jar;
要永久添加jar,请执行以下操作:
1.在Hive Server主机上,创建/ usr / hdp // hive / auxlib目录。
2.Copy /usr/hdp//hive/lib/hive-contrib-.jar to / usr / hdp // hive / auxlib。
3.重新启动HS2服务器。
请进一步参考。
如果您遇到任何问题,请告诉我