gpt4 book ai didi

json - 如何创建 Avro 架构?

转载 作者:行者123 更新时间:2023-12-03 17:48:11 25 4
gpt4 key购买 nike

我想知道这个 json 文档的 Avro 模式是什么样的。
推文.json:

{
"_id": {
"$oid" : "54d148b471eb130b1e8b4567"
},
"nome": "Marco Correia",
"tweet": "This and a simple tweet",
"datahora": "Tue Feb 03 22:15:54 +0000 2015"
}
我创建的架构给出了错误。
架构.avsc:
{
"type" : "record",
"name" : "twitter_schema",
"namespace" : "com.miguno.avro",
"fields" : [
{
"name" : "_id", "type": "array","items": "bytes"
},

{ "name" : "nome","type" : "string","doc" : "Name of the user account on Twitter.com" },
{ "name" : "tweet", "type" : "string","doc" : "The content of the user's Twitter message" },
{ "name" : "datahora", "type" : "string","doc" : "Unix epoch time in seconds"}

],
"doc:" : "A basic schema for storing Twitter messages"
}

最佳答案

以下架构应该有效

{
"type" : "record",
"name" : "twitter_schema",
"namespace" : "com.miguno.avro",
"fields" : [

{"name": "_id", "type":
{
"type" : "record", "name" : "Id", "namespace" : "com.miguno.avro",
"fields" : [
{ "name" : "oid","type" : "string"}
]
}
},
{ "name" : "nome","type" : "string","doc" : "Name of the user account on Twitter.com" },
{ "name" : "tweet", "type" : "string","doc" : "The content of the user's Twitter message" },
{ "name" : "datahora", "type" : "string","doc" : "Unix epoch time in seconds"}

]
}

关于json - 如何创建 Avro 架构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28802063/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com