Hi, For (1) I believe you could do a "Schema.parse meta['avro.schema']" to obtain the schema as an object from the meta entry of the file.
For (2), as defined in the spec at http://avro.apache.org/docs/current/spec.html#Object+Container+Files, since the schema is stored only in the header of the file, using a simple initialised reader will be efficient in reading just that. The file's data blocks are read only upon enumerating over the reader. On Sun, Feb 16, 2014 at 4:52 AM, Tomas Svarovsky <[email protected]> wrote: > Hey, > > I wanted to ask couple of questions. > > 1) Let's assume I have 2 avro files. I would like to grab schemas of both. > Compare them and decide what to do. The only way I found to get to the > schema in a reader is through > > dr = Avro::DataFile::Reader.new(file, Avro::IO::DatumReader.new) > dr.meta > > and that is still stringified JSON. Is this the only way or even is this use > case something supported or should I do it differently? > > 2) Also is ti possible to read just the schema? Sometimes it is useful to > look at a file without actually reading the whole file let's say from s3. > > Regards Tomas -- Harsh J
