问题描述
我有一个简单的Nifi流:
此Nifi流生成嵌套的Json:
{"ts":"10000000000","struct1":{"id1":1,"name1":"test1","struct2":{"id2":2,"name2":"test2"}}}
之后,我尝试使用具有以下设置的PutHive3Streaming Processor将此Json插入到蜂巢表中: PutHive3Streaming properties
JsonTreeReader属性: JsonTreeReader properties
模式文本是Avro模式:
{
"type" : "record","name" : "test","fields" : [
{ "name" : "ts","type" : "string"},{ "name" : "struct1","type" : {
"type" : "record","name" : "struct1","fields" : [
{ "name" : "id1","type" : "int" },{ "name" : "name1",{ "name" : "struct2","type" : {
"type" : "record","name" : "struct2","fields" : [
{ "name" : "id2","type" : "int"},{ "name" : "name2","type" : "string"}
]
}
}
]
}
}
]
}
配置单元表DDL:
create table default.struct_issue (
ts string,struct1 struct<id1:int,name1:string,struct2:struct<id2:int,name2:string>>);
当PutHive3Streaming尝试插入数据时,出现下一个错误: PutHive3Streaming error
看起来Nifi在json中看不到“ struct2”字段,但此字段显示在其中。
更新! Nifi(v1.8.0)出现了相同的问题,并且看起来已经解决(https://issues.apache.org/jira/browse/NIFI-5491),但是问题仍然存在于Nifi(v1.9.0)
P.S。解决方法是,我已使用JSON SerDe属性在蜂巢中成功创建了外部表,并将此json放入与外部表目录匹配的HDFS目录中。我的任务是使用Nifi处理器将此json插入Internal Hive表。 堆栈和版本: Stack and versions
提前谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)