avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Avro Array and combining schema ?
Date Tue, 21 Jan 2014 20:30:52 GMT
It sounds like you'd like to reference schemas in other files?  If so,
you can do this with Maven using the import configuration, added in
https://issues.apache.org/jira/browse/AVRO-1188.  Also the
command-line compiler will process files in order, with types defined
earlier on the command line available in those defined later.  Avro
IDL also has an import command that permits inclusion of types from
.avsc or IDL files.

Doug

On Tue, Jan 21, 2014 at 6:32 AM, ÐΞ€ρ@Ҝ (๏̯͡๏) <deepujain@gmail.com> wrote:
> I have two schemas as follow
>
> 1) Event.avsc
>
> {
>
>     "type": "record", "namespace":"com.nrt.datum.avro", "name" : "Event",
>
>     "fields": [
>
>             {"name" : "guid", "type": ["string", "null"]},
>
>             {"name" : "moreId", "type": ["int", "null"]}
>
>        ]
>
> }
>
>
> 2. Session.avsc
>
> {
>
>     "type": "record", "namespace":"com.nrt.datum.avro", "name" : "Session",
>
>     "fields": [
>
>              {"name" : "isClosed", "type": "boolean"},
>
>              {"name" : "guid", "type": ["string", "null"]}
>
> ]
>
> }
>
>
>
> 1) I want to define a third schema that should SessionContainer, that should
> have all the fields of schema and an array (List) of Event. How do i write
> SessionContainer.avsc  ?
> 2) If i could refer Event.avsc and Session.avsc in SessionContainer.avsc
> then if i change Event/Session, i do not have to change SessionContainer.
>
> I use Java + Avro.
> Any suggestions ?
>
> --
> Deepak
>

Mime
View raw message