Return-Path: X-Original-To: apmail-avro-user-archive@www.apache.org Delivered-To: apmail-avro-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ABFD975DE for ; Wed, 7 Dec 2011 17:11:10 +0000 (UTC) Received: (qmail 94135 invoked by uid 500); 7 Dec 2011 17:11:10 -0000 Delivered-To: apmail-avro-user-archive@avro.apache.org Received: (qmail 94098 invoked by uid 500); 7 Dec 2011 17:11:10 -0000 Mailing-List: contact user-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@avro.apache.org Delivered-To: mailing list user@avro.apache.org Received: (qmail 94089 invoked by uid 99); 7 Dec 2011 17:11:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2011 17:11:10 +0000 X-ASF-Spam-Status: No, hits=-0.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gaurav324@gmail.com designates 209.85.160.171 as permitted sender) Received: from [209.85.160.171] (HELO mail-gy0-f171.google.com) (209.85.160.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2011 17:11:02 +0000 Received: by ghrr15 with SMTP id r15so10726848ghr.30 for ; Wed, 07 Dec 2011 09:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ixQ3VkwJauC1JKsky94kOuGbXljjRRTcjEDodxa2eso=; b=XtPVf5LO/O52scbe/0akUHnDHfcF8zqXbqOPnviukwFC9Y+648JDqZNRTH4iQtnu9I j9pt3MG7Gb/B6F0Jbiyh8sjo8XKjlrTm1WdJkoZU+4m8b2Dbe7EaEhiepW7rwVhiM6xJ UDgZ7V3ffvypshJ3h1ZW8/RTEVTjnNZD6M+wk= MIME-Version: 1.0 Received: by 10.236.190.197 with SMTP id e45mr28732210yhn.101.1323277842023; Wed, 07 Dec 2011 09:10:42 -0800 (PST) Received: by 10.236.138.132 with HTTP; Wed, 7 Dec 2011 09:10:41 -0800 (PST) In-Reply-To: References: <1323263761487-3567316.post@n3.nabble.com> Date: Wed, 7 Dec 2011 22:40:41 +0530 Message-ID: Subject: Re: Map having From: Gaurav Nanda To: user@avro.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org 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? Thanks, Gaurav Nanda On Wed, Dec 7, 2011 at 9:17 PM, Tatu Saloranta wrote: > On Wed, Dec 7, 2011 at 5:16 AM, Gaurav 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 +-