Is that possible to have nullable optional values in AVRO. E.g.:
Avro schema:
{
"type": "record",
"name": "test",
"fields": [
{
"type": [
"null",
"string"
],
"name": "elem"
}
]
}
So that all following data would be possible to encode/decode:
1. { }
2. { "elem" : null }
3. { "elem" : "some-value" }
I've already "fixed" the problem with the 2 and 3 data, since avro would require having { "elem" : { "string": "some-value" } }
, so that's not a problem anymore, but at the same time - trying to encode the 1 will produce 2 in the output, because there is no way to say if the value was present or was null initially.
Create schema with/without fields is not an option, because then I will need to create schema for each combination of fields.