avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Effort towards Avro 2.0?
Date Tue, 03 Dec 2013 15:49:26 GMT
On Mon, Dec 2, 2013 at 1:42 PM, Christophe Taton
<christophe.taton@gmail.com> wrote:
> - New extension data type, similar to ProtocolBuffer extensions (incompatible change).

Extensions might be implemented as something like:

  {"type":"record", "name":"extension", "fields":[
    {"name":"fingerprint", "type": {"type":"fixed", "size":16}},
    {"name":"payload", "type":"bytes"}
    ]
  }

One could then use this with:

  {"type":"record", "name":"Foo", "fields":[
    {"name":"bar", "type":"extension"}
    ]
  }

The implementation could then find the schema for the extension at
runtime given its fingerprint.  The reader could have a table mapping
fingerprints to schemas.

In particular, the specific compiler, when it sees a schema like:


  {"type":"record", "name":"Bar", "isExtension":true, "fields":[
    {"name":"x", "type":"long"}
    ]
  }

Might emit code to add entries to the extension mapping table used by
SpecificDatumReader, e.g.:

  static {
    SpecificData.addExtension(getSchema());
  }

Might something like this work?

Doug

Mime
View raw message