Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Specific compiler task, separate schemas

Copy link to this message
Re: Specific compiler task, separate schemas
On Fri, May 25, 2012 at 11:34 AM, Mark Hayes <[EMAIL PROTECTED]> wrote:
> I have three schemas in separate files, where two are referenced by the
> third:
> When using the ant schema task, if I put these all in one file, only the
> first is compiled.  If I supply three separate files, a separate Parser is
> created for each one, so the reference from MemberInfo to Address/FullName
> can't be resolved.

I found a way around this.  If I put all three schemas in a single JSON
array, in a single JSON document in a file, and parse that file using the
ant SchemaTask, then it works -- it generates classes for all three
schemas.  I assume it will also work when parsing the schema using other

I don't see this documented anywhere and I found it by trial and error.  My
guess is that the top level array is treated as an Avro union, and the
SpecificCompiler doesn't happen to output this top level union type.

I don't know if it is meant to work this way (i.e, will continue to work in
the future), or is just a coincidence.  Does anyone know?