[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Doug Cutting updated AVRO-997: -- Resolution: Fixed Status: Resolved (was: Patch Available) I committed this. Thanks, Sean! > 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 >Assignee: Sean Busbey > Fix For: 1.8.0 > > Attachments: AVRO-997.patch, AVRO-997.patch, AVRO-997.patch, > AVRO-997.permissive-generic-api.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 was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Busbey updated AVRO-997: - Status: Patch Available (was: In Progress) > 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 >Assignee: Sean Busbey > Fix For: 1.8.0 > > Attachments: AVRO-997.patch, AVRO-997.patch, AVRO-997.patch, > AVRO-997.permissive-generic-api.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 was sent by Atlassian JIRA (v6.2#6252)
[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Busbey updated AVRO-997: - Attachment: AVRO-997.patch Updated patch for current trunk; some parts OBE by other tickets, fixed some newer tests. > 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 >Assignee: Sean Busbey > Fix For: 1.8.0 > > Attachments: AVRO-997.patch, AVRO-997.patch, AVRO-997.patch, > AVRO-997.permissive-generic-api.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 was sent by Atlassian JIRA (v6.2#6252)
[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Busbey updated AVRO-997: - Status: In Progress (was: Patch Available) > 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 >Assignee: Sean Busbey > Fix For: 1.8.0 > > Attachments: AVRO-997.patch, AVRO-997.patch, > AVRO-997.permissive-generic-api.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 was sent by Atlassian JIRA (v6.2#6252)
[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Busbey updated AVRO-997: - Attachment: AVRO-997.permissive-generic-api.patch Alternative non-breaking patch. Makes the generic api more permissive about use of things other than GenericEnumSymbol with enum schemas. See [review board|https://reviews.apache.org/r/7606/] for details. > 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 >Assignee: Sean Busbey > Fix For: 1.8.0 > > Attachments: AVRO-997.patch, AVRO-997.patch, > AVRO-997.permissive-generic-api.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
[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Doug Cutting updated AVRO-997: -- Assignee: Sean Busbey Status: Patch Available (was: Open) Thanks, Sean. The tests look great. I'll commit this soon unless there are objections. I think the minor incompatible runtime change here should cause our next release to be called 1.8.0 rather than 1.7.3. But I'll delay changing the Fix-for on other 1.7.3 issues for now though in case we decide to do a compatible 1.7.3 bugfix release. > 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 >Assignee: Sean Busbey > Fix For: 1.8.0 > > Attachments: AVRO-997.patch, 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
[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Busbey updated AVRO-997: - Attachment: AVRO-997.patch Updated patch with tests that fail if GenericData.validate or GenericDatumWriter.write allow the use of String/Java Enum with an Avro enum schema. Also adds a constructor to GenericData.EnumSymbol to ease proper use of the generic api. > 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, 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
[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Doug Cutting updated AVRO-997: -- Fix Version/s: 1.8.0 Hadoop Flags: Incompatible change > 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
[jira] [Updated] (AVRO-997) Union of enum and null cannot be serialized
[ https://issues.apache.org/jira/browse/AVRO-997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Doug Cutting updated AVRO-997: -- Attachment: AVRO-997.patch I think GenericData#validate() and GenericDatumWriter#writeEnum() could both be stricter, failing when isEnum(datum) is false. That would be an incompatible change though, possibly breaking applications. Here's the patch I used to try this. Tests pass. We should probably add some tests that fail without this change too before committing something like this. > 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