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 0F95C10908 for ; Fri, 21 Feb 2014 12:03:47 +0000 (UTC) Received: (qmail 32087 invoked by uid 500); 21 Feb 2014 12:03:43 -0000 Delivered-To: apmail-avro-user-archive@avro.apache.org Received: (qmail 31934 invoked by uid 500); 21 Feb 2014 12:03:41 -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 31926 invoked by uid 99); 21 Feb 2014 12:03:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Feb 2014 12:03:39 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of harsh@cloudera.com designates 209.85.219.44 as permitted sender) Received: from [209.85.219.44] (HELO mail-oa0-f44.google.com) (209.85.219.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Feb 2014 12:03:34 +0000 Received: by mail-oa0-f44.google.com with SMTP id g12so4020893oah.3 for ; Fri, 21 Feb 2014 04:03:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=usdZ274gc2py9eJhgkJVX9wDl8JyczMXoUViJLXzOW4=; b=LInb54fMB1z1hsLHZOn9XhtQSJXNqGs8TDD9gyVBgPhQZDvAaHqSwvojSbex94q0TM /JzN0s5ahZ8KPErE3cEgHL/T4bsEL1vnElH1E0/7i9ATT1Z7hTjfe3kNVU6NHBUwOyGu /w/RfFuAEHicLOyjHqQmInc35ByoM7HU00SLyJ6pV4loM9KRXa//mOuXOxiz+Cgf2r5q yiCayPeeNjDjiri2vvNK8PkVlLZvhojPKNg4vWbIDKBIAPi9rSmE2BVYf7NCy7Jgv1HZ R8xov75v+MqE7Fyyfn371k3PGMlT2Lc82mqa3z+YsCp1XsQobCm2ZwKE9sPtcFf/U8nG 8Nlg== X-Gm-Message-State: ALoCoQmok80iV2Oj/8I1jHjcMm0YCL/8lBawrdAH+UDXpZu/nXC1cmbePCulU6ngLVNFDZawKY/m X-Received: by 10.42.231.5 with SMTP id jo5mr3476846icb.23.1392984193848; Fri, 21 Feb 2014 04:03:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.61.97 with HTTP; Fri, 21 Feb 2014 04:02:52 -0800 (PST) In-Reply-To: References: From: Harsh J Date: Fri, 21 Feb 2014 17:32:52 +0530 Message-ID: Subject: Re: Schema inheritance To: "user@avro apache. org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Use of protocol schemas in IDLs is optional. On Fri, Feb 21, 2014 at 5:52 AM, Software Dev wrote: > I should also note that the IDL introduced another concept that we > previously were dealing with... protocol. Is the protocol just a grouping of > related records? > > FYI, we are using Avro strictly for serialization/de-serialization and no > RPC features. > > > On Thu, Feb 20, 2014 at 4:19 PM, Software Dev > wrote: >> >> We have a similar use case and I would like to just "flatten" out the >> schema by including the fields from the parent into the child without >> nesting. The reason I don't want to nest is because it doesnt play well with >> some of our tools (Impala, Pig, etc) >> >> Now back to your initial response. I started playing around with the IDL >> but I still can't seem to figure out how to inherit all the fields from a >> parent into a child record. >> >> I would like the final "Chile" record to look like: >> >> { >> "type": "record", >> "name": "Child", >> "fields" : [ >> { >> "name": "bar", >> "type": "string" >> }, >> { >> "name": "foo", >> "type": "string" >> } >> ] >> } >> >> >> On Thu, Feb 20, 2014 at 12:55 PM, Lewis John Mcgibbney >> wrote: >>> >>> Going back to your initial question... why don't you wish to include >>> "foo" within nested "parent"? >>> I am not quite getting it here. >>> In my case, the nested records were of substantial size including dozens >>> of fields, which then had nested records. It did not scale to write out AVSC >>> definitions for the data model. >>> >>> >>> On Thu, Feb 20, 2014 at 8:28 PM, Software Dev >>> wrote: >>>> >>>> Thanks for the input. I'm guessing then the above problem can only >>>> solved with IDL and not AVSC? >>>> >>>> >>>> On Thu, Feb 20, 2014 at 11:45 AM, Lewis John Mcgibbney >>>> wrote: >>>>> >>>>> Hey, >>>>> Did you check out the IDL documentation? >>>>> http://avro.apache.org/docs/current/idl.html >>>>> I had similar data modeling issues a while back and this helped out A >>>>> LOT. >>>>> hth >>>>> >>>>> >>>>> On Thu, Feb 20, 2014 at 6:58 PM, Software Dev >>>>> wrote: >>>>>> >>>>>> Is there anyway to include the fields of another schema into our >>>>>> schema WITHOUT it creating a nested record? >>>>>> >>>>>> >>>>>> { >>>>>> "type": "record", >>>>>> "name": "Parent", >>>>>> "fields" : [ >>>>>> { >>>>>> "name": "foo", >>>>>> "type": "string" >>>>>> } >>>>>> ] >>>>>> } >>>>>> >>>>>> { >>>>>> "type": "record", >>>>>> "name": "Child", >>>>>> "fields" : [ >>>>>> { >>>>>> "name": "bar", >>>>>> "type": "string" >>>>>> }, >>>>>> // I dont want it nested like this >>>>>> // { >>>>>> // "name": "parent", >>>>>> // "type": "Parent" >>>>>> // } >>>>>> ] >>>>>> } >>>>>> >>>>>> So in this example is there a way to have child include both the "bar" >>>>>> field as well as "foo" without it nested under parent? >>>>>> >>>>>> Thanks >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Lewis >>>> >>>> >>> >>> >>> >>> -- >>> Lewis >> >> > -- Harsh J