Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.1
-
None
-
None
-
Incompatible change
-
Description
I have a schema like:
[ { "type": "enum", "name": "Gender", "symbols": ["M", "F"] }, { "type" : "record", "name" : "Foo", "fields" : [ { "type" : ["Gender", "null"], "name" : "gender" }, ... ] } ]
I build a record like Foo foo = new Foo(); foo.gender = Gender.M;
When I go to serialize this, I get:
Not in union [{"type":"enum","name":"Gender","symbols":["M","F"]},"null"]: M at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:482) at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:70) at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:104) at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:65) at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:57)