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

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


+
Mark Hayes 2012-05-25, 18:34
+
Mark Hayes 2012-05-31, 01:04
Copy link to this message
-
Re: Specific compiler task, separate schemas
On 05/30/2012 06:04 PM, Mark Hayes wrote:
> 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
> tools.
>
> 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.

That's right.

> 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?

This will continue to work in the future.  Other folks rely on it.

The Ant task might be improved to make this easier.  If the task reused
the SpecificCompiler instance then one might be able to specify the
compiler input as something like:

<fileset>
   <filename name="T1.avsc"/>
   <filename name="T2DependsonT1"/>
</fileset>

If this sounds useful to you, please file an issue in Jira.

Doug
+
Mark Hayes 2012-06-01, 18:55