Hello,


I was looking at an older issue which was present in 1.7 and 1.8 and was
wondering if it has been resolved in 1.9?



In the documentation for 1.8 and 1.9 (
https://avro.apache.org/docs/1.9.2/spec.html#Unions ) we can read that “the
default value of such unions is typically null”.



When we check for compatibility between reader and writer, we assume that
the writer contains the same field or that the reader has a default value.
An error is returned if there is no default value:



https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/SchemaCompatibility.java#L404



There is a special case for enums, but no special case for unions. Assuming
we have a field like below, are we going to get an error?



{ "name": "year", "type": ["null", "string"] }



According to the docs, this should still work even without a default value,
because the default value of such a union would be null.



Do I interpret this right?



Thanks,

Csaba

Reply via email to