Avro field default values

旧巷老猫 提交于 2019-11-30 04:45:21

The default value of a union corresponds to the first schema of the union (Source). Your union is defined as ["long", "null"] therefor the default value must be a long number. null is not a long number that is why you are getting an error.

If you still want to define null as a default value then put null schema first, i.e. change the union to ["null", "long"] instead.

Its a bug at Avro's end which is marked as Not A Problem . You need to add default attribute to mention default value.

{"name": "xxx", "type": ["null", "boolean"], "default": null}

Please refer AVRO-1803.

You must provide "default": null not "default": "null" in the schema to get the builder method working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!