[ https://issues.apache.org/jira/browse/AVRO-1569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14349629#comment-14349629 ]
ASF GitHub Bot commented on AVRO-1569: -------------------------------------- GitHub user sachingsachin opened a pull request: https://github.com/apache/avro/pull/22 AVRO-1569: Check base-classes too while resolving unions You can merge this pull request into a Git repository by running: $ git pull https://github.com/sachingsachin/avro AVRO-1569 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/avro/pull/22.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #22 ---- commit eacbb109ef73b670753d3b4adf6f43d29088c7fd Author: Sachin Goyal <sgo...@walmart.com> Date: 2015-03-05T23:36:45Z AVRO-1569: Check base-classes too while resolving unions ---- > ReflectData.AllowNull fails with polymorphism > --------------------------------------------- > > Key: AVRO-1569 > URL: https://issues.apache.org/jira/browse/AVRO-1569 > Project: Avro > Issue Type: Bug > Affects Versions: 1.7.6 > Reporter: Sachin Goyal > > UnresolvedUnionException is thrown if the following structure is serialized > with ReflectData.AllowNull > (Plain ReflectData works fine) > {code} > class Base > { > Integer a = 5; > } > class Derived extends Base > { > String b = "Foo"; > } > class PolymorphicDO > { > Base obj = new Derived(); > } > // Serialization code: > ReflectData rdata = ReflectData.AllowNull.get(); > Schema schema = rdata.getSchema(PolymorphicDO.class); > ReflectDatumWriter<T> datumWriter = new ReflectDatumWriter > (PolymorphicDO.class, rdata); > DataFileWriter<T> fileWriter = new DataFileWriter<T> (datumWriter); > fileWriter.create(schema, new ByteArrayOutputStream()); > fileWriter.append(new PolymorphicDO()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)