【发布时间】:2018-04-16 14:14:41
【问题描述】:
我正在使用 NiFi (v1.2) 处理器 ConvertJSONToAvro。我无法解析仅包含“记录”类型中 2 个元素中的 1 个的记录。该元素也可以完全从数据中丢失。我的 Avro 架构不正确吗?
架构 sn-p:
"name": "personname",
"type": [
"null":,
{
"type": "record",
"name": "firstandorlast",
"fields": [
{
"name": "first",
"type": [
"null",
"string"
]
},
{
"name": "last",
"type": [
"null",
"string"
]
}
]
}
]
如果“personname”同时包含“first”和“last”,它可以工作,但如果它只包含其中一个元素,则会失败并出现错误:Cannot convert field personname: cannot resolve union: {"last":" Smith"} 不在 "type": [ "null":, { "type": "record", "name": "firstandorlast", "fields": [ { "name": "first", "type": [ "null", "string" ] }, { "name": "last", "type": [ "null", "string" ] } ] } ]
【问题讨论】:
标签: avro apache-nifi