[prev in list] [next in list] [prev in thread] [next in thread]
List: avro-dev
Subject: [jira] [Created] (AVRO-1570) ReflectData.AllowNull fails with polymorphism and @Union annotation
From: "Sachin Goyal (JIRA)" <jira () apache ! org>
Date: 2014-08-22 4:29:11
Message-ID: JIRA.12735982.1408681735075.9719.1408681751323 () arcas
[Download RAW message or body]
Sachin Goyal created AVRO-1570:
----------------------------------
Summary: ReflectData.AllowNull fails with polymorphism and @Union annotation
Key: AVRO-1570
URL: https://issues.apache.org/jira/browse/AVRO-1570
Project: Avro
Issue Type: Bug
Affects Versions: 1.7.6
Reporter: Sachin Goyal
Nested union exception is thrown if the following structure is serialized with ReflectData.AllowNull
(Plain ReflectData works fine)
{code}
@Union({Derived.class})
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.2#6252)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic