I有以下avsc (Avsc) :
{
"type": "record",
"name": "DataEventId",
"fields": [
{
"name": "redeliveredDataEventIndices",
"type": { "type": "array", "items": "int" },
"doc" : "Data event indices",
"default": []
},
],
"namespace": "com.xxx.xxx.xxx"
}
当我尝试用这个架构将json转换为avro时,我得到以下错误:
org.apache.avro.AvroTypeException: Expected start-union. Got VALUE_STRING
我的输入数据:
{"redeliveredDataEventIndices":"[]"}
我知道这是How to fix Expected start-union. Got VALUE_NUMBER_INT when converting JSON to Avro on the command line?的重复,但是如何为类型数组提供输入(在本例中,redeliveredDataEventIndices是int类型的数组)。
发布于 2020-02-04 08:42:31
您的输入数据将数组包装为引号,因此将其视为字符串。
试一试:
{"redeliveredDataEventIndices":[]}
https://stackoverflow.com/questions/60053309
复制相似问题