avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S G <sg.online.em...@gmail.com>
Subject Supporting Polymorphic fields in Avro
Date Wed, 20 Aug 2014 23:40:23 GMT
Hi,

We want to use Java polymorphic fields with Avro.
Here is an example of the same.

----------------------------------------
class Base
{
   Integer a = 5;
}

class Derived extends Base
{
    String b = "Foo";
}

class PolymorphicDO
{
   Base b = new Derived();
}
----------------------------------------


Jackson handles this kind of field by using annotations such as:
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include =
JsonTypeInfo.As.PROPERTY, property = "@class”)


If such a thing can be added to Avro, it can really handle a large number
of Java designs without changes and same could be immediately useful in
Hadoop using AvroSerde as well.

I can work on a patch if the feature seems useful.

Thanks
Sachin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message