[
https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13471802#comment-13471802
]
Doug Cutting commented on AVRO-997:
-----------------------------------
> I can add some tests that fail suitably.
Great! Thanks!
> would it be fine if I added a constructor to GenericData.EnumSymbol that
> allowed for Java Enums for the passed in symbol?
I don't see a problem with that. We might have a constructor that accepts
Object and calls toString()?
> Union of enum and null cannot be serialized
> -------------------------------------------
>
> Key: AVRO-997
> URL: https://issues.apache.org/jira/browse/AVRO-997
> Project: Avro
> Issue Type: Bug
> Affects Versions: 1.5.1
> Reporter: Aaron Kimball
> Fix For: 1.8.0
>
> Attachments: AVRO-997.patch
>
>
> I have a schema like:
> {code}
> [
> {
> "type": "enum",
> "name": "Gender",
> "symbols": ["M", "F"]
> },
> {
> "type" : "record",
> "name" : "Foo",
> "fields" : [
> { "type" : ["Gender", "null"], "name" : "gender" },
> ...
> ]
> }
> ]
> {code}
> I build a record like {{Foo foo = new Foo(); foo.gender = Gender.M;}}
> When I go to serialize this, I get:
> {code}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)
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira