avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gaurav Nanda <gaurav...@gmail.com>
Subject Re: Map having <string, Object>
Date Wed, 07 Dec 2011 17:10:41 GMT
I agree that in this case Json would be equally helpful. But In my
application there is one more type of message, where untagged data can
provide compact data encoding. So to maintain consistency, I preferred
to send these kind of messages also using avro.

@where untagged data can provide compact data encoding.
In that case also, my schema has to be dynamically generated (i.e. on
runtime), so has to be passed to client. So would avro be better to
compressed json is that case?

Gaurav Nanda

On Wed, Dec 7, 2011 at 9:17 PM, Tatu Saloranta <tsaloranta@gmail.com> wrote:
> On Wed, Dec 7, 2011 at 5:16 AM, Gaurav <gaurav324@gmail.com> wrote:
>> Hi,
>> We have a requirement to send typed(key-value) pairs from server to clients
>> (in various languages).
>> Value can be one of primitive types or a map of same (string, Object) type.
>> One option is to construct record schema on the fly and second option is to
>> use unions to write schema in a general way.
>> Problems with 1 is that we have to construct schema everytime depending upon
>> keys and then attach the entire string schema to a relatively small record.
>> But in second schema, u don't need to write schema on the wire as it is
>> present with client also.
>> I have written one such sample schema:
>> {"type":"map","values":["int","long","float","double","string","boolean",{"type":"map","values":["int","long","float","double","string","boolean"]}]}
>> Do you guys think writing something of this sort makes sense or is there any
>> better approach to this?
> For this kind of loose data, perhaps JSON would serve you better,
> unless you absolutely have to use Avro?
> -+ Tatu +-

View raw message