我如何为数组的数组写一个avro模式?

  • 本文关键字:数组 一个 avro 模式 avro
  • 更新时间 :
  • 英文 :


例如,我试过这个,但它不起作用。我必须创建一个模式,在一个字段中包含数组的数组,但我做不到。

{
"name": "SelfHealingStarter",
"namespace": "SCP.Kafka.AvroSchemas",
"doc": "Message with all the necessary information to run Self Healing process.",
"type": "record",
"fields": [
{
"name": "FiveMinutesAgoMeasurement",
"type": "record",
"doc": "Field with all five minutes ago measurement.",
"fields": [
{
"name": "equipments",
"doc": "List with all equipments measurement.",
"type": {
"type": "array",
"items": {
"type": {
"type": "array",
"items": "string"
},
"default": []
}
},
"default": []
}
]
}
]
}

IDL

protocol Example {
record Foo {
array<array<string>> data = [];
}
}

AVSC fromjava -jar ~/workspace/avro-tools-1.8.2.jar idl2schemata example.idl

{
"type" : "record",
"name" : "Foo",
"fields" : [ {
"name" : "data",
"type" : {
"type" : "array",
"items" : {
"type" : "array",
"items" : "string"
}
},
"default" : [ ]
} ]
}

相关内容

  • 没有找到相关文章

最新更新