avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Graham <billgra...@gmail.com>
Subject Compiling multiple input schemas
Date Tue, 16 Aug 2011 20:38:37 GMT
Hi,

With Avro-874, multiple inter-dependent schema files can be parsed. I've
written a patch to the SpecificCompilerTool to allow the same when producing
java from multiple schemas that I'd like to contribute for consistency if
there's interest. It allows you to pass multiple input files like this:

$ java -cp avro-tools-1.6.0.jar org.apache.avro.tool.Main compile schema
input/position.avsc,input/player.avsc tmp/

While I was at it, it seemed useful to parse an entire directory of schema
files as well so I implemented this:

$ java -cp avro-tools-1.6.0.jar org.apache.avro.tool.Main compile schema
input/ tmp/

The latter approach will not work properly for files with dependencies,
since the file order probably isn't in reverse dependency order. If that's
the case, a combination of files and directories can be used to force an
ordering. So if b depends on a and other files depend on either of them you
could do this:

$ java -cp avro-tools-1.6.0.jar org.apache.avro.tool.Main compile schema
input/a.avsc,input/b.avsc,input/ tmp/

Let me know if some or all of this seems useful to contribute. The first
example is really the main one that I need. I've done the same for Protocol
as well btw.

thanks,
Bill

Mime
View raw message