Avro schema doesn't honor backward compatibilty

前端 未结 3 1893
甜味超标
甜味超标 2021-01-17 18:53

I have this avro schema

{
 \"namespace\": \"xx.xxxx.xxxxx.xxxxx\",
 \"type\": \"record\",
 \"name\": \"MyPayLoad\",
 \"fields\": [
     {\"name\": \"filed1\"         


        
3条回答
  •  轮回少年
    2021-01-17 19:19

    There are two possible issues that i can see in your schema

    1. The default value for me always seems to have work as null to specify this you need to set

    "default": null

    1. Also in your schema you did forget to add a , (field separator) between the array and new field. Hence try changing your schema as

    { "namespace": "xx.xxxx.xxxxx.xxxxx", "type": "record", "name": "MyPayLoad", "fields": [ {"name": "filed1", "type": "string"}, {"name": "filed2", "type": "long"}, {"name": "filed3", "type": "boolean"}, { "name" : "metrics", "type": { "type" : "array", "items": { "name": "MyRecord", "type": "record", "fields" : [ {"name": "min", "type": "long"}, {"name": "max", "type": "long"}, {"name": "sum", "type": "long"}, {"name": "count", "type": "long"} ] } } }, {"name": "agentType", "type": ["null", "string"], "default":null} ] }

提交回复
热议问题