avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matan Amir <ma...@apple.com>
Subject Re: Modeling Common Fields?
Date Thu, 27 Feb 2014 19:23:56 GMT
Thanks Doug,

Yep this would work.  It does move the enforcement outside Avro but I guess that’s ok :)

Thanks!
Matan

On Feb 27, 2014, at 9:49, Doug Cutting <cutting@apache.org> wrote:

> This might be handled using GenericData.  You'd specify no reader
> schema when you create your GenericDatumReader so the in-memory data
> is represented using the same schema it was written with.  Then use
> GenericRecord#put & get to access the fields you require.
> 
> http://avro.apache.org/docs/current/api/java/org/apache/avro/generic/GenericRecord.html
> 
> Might that work?
> 
> Doug
> 
> 
> On Tue, Feb 25, 2014 at 4:10 PM, Matan Amir <mamir@apple.com> wrote:
>> Hi Avro experts :)
>> 
>> I was searching for an answer in the group already and didn’t find something that
I recognized as the answer to this so I apologize if i’m asking something that has been
answered frequently.
>> 
>> Let’s say I had a Java library that would send out Avro data over the wire.  However,
the library would not own the Avro schemas nor know what the schemas were in advance.  The
library only required that the schemas contain two specific fields that it would then set
on the way out - like a string field and a timestamp.
>> 
>> What is the best way to model this for Avro?  In protobufs this is modeled with a
base schema and “extensions” which third parties would use to include their specific fields.
 Is there a way in Avro to get the same result?
>> 
>> Thanks and much appreciated!
>> Matan


Mime
View raw message