Java – invalid default value for field warning message from Avro?
•
Java
I have an Avro architecture like this, where I will be is_ userid_ I want to set the default value to false, so I propose the following Avro architecture
{ "type":"record","name":"hello","fields":[ { "name":"u","type":[ "string","null" ] },{ "name":"p","type":"string" },{ "name":"bu","type":"boolean" },{ "name":"is_userid_present","type":"boolean","default":"false" } ] }
But from the Avro code, I see this warning message –
[WARNING] Avro: Invalid default for field is_userid_present: "false" not a "boolean"
I'm not sure what I did wrong here? If I had such an Avro architecture, would there be any problems writing and reading data?
Solution
According to Avro docs, if you specify a default Boolean value, you can't make a string as you own it
Try this
{ "name": "is_userid_present","type": "boolean","default": false }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码