我在减少具有字符串和数组值的avro文件的 map 处理中遇到问题。
`Describe hdfs:/test/test.avro
number STRING
totalProductFee STRING
productID STRING
otherPartyId STRING
module STRING
client STRING
Event_DA ARRAY
Event_DA.recType STRING
Event_DA.AccountID STRING
Event_DA.Identifier STRING
Event_DA.ValueBefore STRING
Event_DA.ValueAfter STRING
Event_DA.Change STRING
Event_DA.ExpiryDate STRING
但是,当我尝试运行作业以与记录值的数组[Event_DA]一起获取时,出现以下异常:
当组合字符串类型和记录数组时,看起来问题出在输入模式文件上。
请为您提供有关这些类型的avro文件的示例架构文件的宝贵建议。
最佳答案
根据您的架构定义,Event_DA将是“记录”类型,而不是“数组”类型。
您的Avro模式如下所示:
{
"type":"record",
"name":"myrecordname"
"fields": [
{"name": "number", "type": "string"},
{"name": "totalProductFee", "type": "string"},
.......
{"name": "Event_DA", "type": {"type":"record, "name":"Event_DA",
"fields": [{"name":"recType", "type":"string"},
{"name":"AccountID", "type":"string"},
.......
]
}
}
]}
关于hadoop - org.apache.avro.AvroTypeException失败的Avro Mapreduce作业,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38600627/