While running kafka consumer, i am getting following error:
Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 13
Caused by: org.apache.avro.AvroTypeException: Invalid default for field key_id: "null" not a ["null",{"type":"string","avro.java.string":"String"}]
at org.apache.avro.Schema.validateDefault(Schema.java:1512)
at org.apache.avro.Schema.access$300(Schema.java:86)
at org.apache.avro.Schema$Field.<init>(Schema.java:493
My avro schema is like this :
{ "name": "key_id", "type": [ "null", "string" ], "default": "null"},
I have tried multiple options to solve this problem, but it is still there.
You need to set "default": null
, as opposed to "default":"null"
:
{ "name": "key_id", "type": [ "null", "string" ], "default": null},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With