You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Arvind Kalyan <ba...@gmail.com> on 2013/10/31 22:20:43 UTC

Partial lookup without full deserialization

Folks, say I serialize a GenericData.Record with some schema {a: int, b:
string, c: array[int]} into a byte[] and send it over the wire.

On the receiving side, once I have this byte[] is it possible for me to
lookup just the field 'a' without incurring the cost of deserializing all
the fields?

Any other thoughts around trying to optimize partial lookups?

thanks
-- 
Arvind Kalyan
http://www.linkedin.com/in/base16

Re: Partial lookup without full deserialization

Posted by Doug Cutting <cu...@apache.org>.
You can specify a reader schema of simply {a:int}.  Avro will
efficiently skip missing fields when parsing values.  Note that you
still need the original, full schema (the "writer" schema).  This is
achieved through the schema resolution rules.

http://avro.apache.org/docs/current/spec.html#Schema+Resolution

Doug

On Thu, Oct 31, 2013 at 5:20 PM, Arvind Kalyan <ba...@gmail.com> wrote:
> Folks, say I serialize a GenericData.Record with some schema {a: int, b:
> string, c: array[int]} into a byte[] and send it over the wire.
>
> On the receiving side, once I have this byte[] is it possible for me to
> lookup just the field 'a' without incurring the cost of deserializing all
> the fields?
>
> Any other thoughts around trying to optimize partial lookups?
>
> thanks
> --
> Arvind Kalyan
> http://www.linkedin.com/in/base16
>