AVRO 模式的 JSON 看起来有效但 returns 输入不是有效的 Avro 模式
AVRO schema's JSON looks valid but returns Input is not a valid Avro schema
我正在尝试将数据上传到 AWS Personalize 中的用户数据集。该架构包含我的 CSV 的结构。我在网上查了 JSON,它显示有效 JSON.
{
"type": "record",
"name": "Users",
"namespace": "com.amazonaws.personalize.schema",
"fields": [
{
"name": "user_id",
"type": "string"
},
{
"name": "address",
"type": "record",
"fields" : [
{"name": "address1", "type": "string"},
{"name": "address2", "type": "string"},
{"name": "city", "type": "string"},
{"name": "state", "type": "string"},
{"name": "postalCode", "type": "int"},
{"name": "coordinates", "type": "record",
"fields" : [
{"name": "lat", "type": "float"},
{"name": "lng", "type": "float"}
]}
]
},
{
"name": "firstName",
"type": "string"
},
{
"name": "followRequestId",
"type": "array",
"items": "string"
},
{
"name": "followers",
"type": "array",
"items": "string"
},
{
"name": "fullName",
"type": "string"
},
{
"name": "gender",
"type": "string"
},
{
"name": "interests",
"type": "array",
"items": "string"
},
{
"name": "lastActive",
"type": "long"
},
{
"name": "lastName",
"type": "string"
},
{
"name": "network",
"type": "list"
},
{
"name": "paymentDetails",
"type": "int"
},
{
"name": "personalOccasions",
"type": "array",
"items": "string"
},
{
"name": "productLikeDislike",
"type": "array",
"items": "string"
},
{
"name": "registrationDate",
"type": "long"
},
{
"name": "rewardId",
"type": "string"
},
{
"name": "wishList",
"type": "array",
"items": "string"
}
],
"version": "1.0"
}
您没有正确写入记录字段。
示例:
...
{
"name":"address1",
"type":{
"type":"record",
"name": "address",
"fields": [...]
}
}
...
所以当你把记录写成一个字段时,首先你有字段名,然后是 "generic" 记录(这类似于 class 的方式:address1 是变量和地址是 class).
我正在尝试将数据上传到 AWS Personalize 中的用户数据集。该架构包含我的 CSV 的结构。我在网上查了 JSON,它显示有效 JSON.
{
"type": "record",
"name": "Users",
"namespace": "com.amazonaws.personalize.schema",
"fields": [
{
"name": "user_id",
"type": "string"
},
{
"name": "address",
"type": "record",
"fields" : [
{"name": "address1", "type": "string"},
{"name": "address2", "type": "string"},
{"name": "city", "type": "string"},
{"name": "state", "type": "string"},
{"name": "postalCode", "type": "int"},
{"name": "coordinates", "type": "record",
"fields" : [
{"name": "lat", "type": "float"},
{"name": "lng", "type": "float"}
]}
]
},
{
"name": "firstName",
"type": "string"
},
{
"name": "followRequestId",
"type": "array",
"items": "string"
},
{
"name": "followers",
"type": "array",
"items": "string"
},
{
"name": "fullName",
"type": "string"
},
{
"name": "gender",
"type": "string"
},
{
"name": "interests",
"type": "array",
"items": "string"
},
{
"name": "lastActive",
"type": "long"
},
{
"name": "lastName",
"type": "string"
},
{
"name": "network",
"type": "list"
},
{
"name": "paymentDetails",
"type": "int"
},
{
"name": "personalOccasions",
"type": "array",
"items": "string"
},
{
"name": "productLikeDislike",
"type": "array",
"items": "string"
},
{
"name": "registrationDate",
"type": "long"
},
{
"name": "rewardId",
"type": "string"
},
{
"name": "wishList",
"type": "array",
"items": "string"
}
],
"version": "1.0"
}
您没有正确写入记录字段。
示例:
...
{
"name":"address1",
"type":{
"type":"record",
"name": "address",
"fields": [...]
}
}
...
所以当你把记录写成一个字段时,首先你有字段名,然后是 "generic" 记录(这类似于 class 的方式:address1 是变量和地址是 class).