-RE: Parsing Nested Schemas in Avro C++
徐凡 2013-12-17, 18:38
I'm not sure if C++ can do that. But I was able to use java to compile nested schema, it will give you several java classes after using avro-tool-1.7.5 to compile that.
> Date: Tue, 17 Dec 2013 02:17:00 -0800
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: Parsing Nested Schemas in Avro C++
> Is there a C++ equivalent of the following Java functionality?
> / public static class Schema.Parser extends Object
> A parser for JSON-format schemas. Each named schema parsed with a parser
> is added to the names known to the parser so that subsequently parsed
> schemas may refer to it by name.
> We have used this class from the Avro Java API to obtain a parser, and
> pre-parse complex object type schemas which are referred to in later
> schemas. E.g. we have parsed a record schema called "location", and referred
> to this subsequently by name in another (higher level) schema.
> Now trying to do the equivalent with the C++ API, and so far I have not
> found this functionality.
> I can do (from the documentation):
> / // My schema is stored in a file called “example”
> std::ifstream in(“example”);
> avro::ValidSchema mySchema;
> avro::compileJsonSchema(in, mySchema);
> But this appears to only parse a single schema. It doesn't return a handle
> to the parser which can be used to parse further schemas. If I try putting
> multiple schemas in the input stream, it only parses the first one.
> View this message in context: http://apache-avro.679487.n3.nabble.com/Parsing-Nested-Schemas-in-Avro-C-tp4028801.html
> Sent from the Avro - Users mailing list archive at Nabble.com.