我在我的avro架构中为favorite_number可能是null或int。当我JSON编码的对象,我得到:json avro union的编码
{ “名”: “贾静雯”, “favorite_number”:{ “INT”:7}, “favorite_color”:空}
我试图摆脱对于联合类型的指示器,在这种情况下的整型,使其变成:
{ “名称”: “阿莉莎”, “favorite_number”:7, “favorite_color”: “蓝”}
avro schema:
{"name": "person", "type": "record",
"fields": [
{"name": "name", "type": "string"},
{"name": "favorite_number", "type": ["null", "int"], "default": null},
{"name": "favorite_color", "type": "string"}
]
}
I有没有办法做到这一点?谢谢!
你应该显示一些代码你是怎么做到的? –
你有没有得到如何解决这个问题? – Prashanth