在avdl文件中创建数组模式以写入kafka

odopli94  于 2021-06-04  发布在  Kafka
关注(0)|答案(0)|浏览(236)

我正试图用avroserializer将数据发布到Kafka主题。我的一列有一个字符串数组。
示例数据如下所示:

{
"exp_user_id":"1004977",
"site_name":"EXPEDIA.MX",
"score": "0.645651633153341",
"decile": "25",
"next_best_action": [["6.719064841905476E-5","app_purchase"],["5.866961664787799E-5","app_purchase"],["1.016999934388668E-4","download_app"]],
"create_date": "2020-06-08"
}

我正试图为上面的数据集创建一个avdl文件,但在创建字符串数组时出错。

{
    "type" : "record",
    "name" : "ek_el_nba_test",
    "namespace" : "com.extensions",
    "fields" : [{"name" : "user_id", 
                 "type" : "string", 
                 "default" : "NONE"},

                {"name" : "site_name", 
                  "type" : "string", 
                  "default" : "NONE"},

                 {"name" : "score", 
                  "type" : "string", 
                  "default" : "NONE"},

                 {"name" : "decile", 
                  "type" : "string", 
                  "default" : "NONE"},

                  {"name" : "next_best_action", 
                   {"type" : "array", "items" : "array"},
                   "default": []
                   },

                    {"name" : "create_date", 
                  "type" : "string", 
                  "default" : "NONE"},
                          "default" : {}
                }
]
}

谢谢你的帮助。!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题