【发布时间】:2017-09-16 17:03:42
【问题描述】:
我正在尝试使用这个 avro shcema
{
"namespace": "nothing",
"name": "myAvroSchema",
"type": "record",
"fields": [
{
"name": "checkInCustomerReference",
"type": "string"
},
{
"name": "customerContacts",
"type": "record",
"fields": [
{
"name": "customerEmail",
"type": "array",
"items": {
"type": "record",
"name": "customerEmail_element",
"fields": [
{
"name": "emailAddress",
"type": "string"
},
{
"name": "typeOfEmail",
"type": "string"
}
]
}
},
{
"name": "customerPhone",
"type": "array",
"items": {
"type": "record",
"name": "customerPhone_element",
"fields": [
{
"name": "fullContactNumber",
"type": "string"
},
{
"name": "ISDCode",
"type": "string"
}
]
}
},
{
"name": "DonotAskIndicator",
"type": "record",
"fields": [
{
"name": "donotAskDetails",
"type": "string"
}
]
}
]
},
{
"name": "somethingElseToCheck",
"type": "string"
}
]
}
使用 avro 工具生成和 avro 文件:
avro-tools fromjson --schema-file myAvroSchema.avsc myJson.json > myAvroData.avro
但我收到以下错误消息:
线程“主”org.apache.avro.SchemaParseException 中的异常: “记录”不是一个定义的名称。 “customerContacts”的类型 字段必须是定义的名称或 {"type": ...} 表达式。
谁能告诉我为什么记录没有被识别为定义的名称?
【问题讨论】:
标签: json avro avro-tools