thanks for reply. I used both command line tool and the api code as below: GenericDatumReader datum = new GenericDatumReader(); DataFileReader reader = new DataFileReader(inFile, datum); Schema schema = reader.getSchema();
I guss the problem is with the avro file, I know the file is not written with avro library. we are working on some other solutions. thanks! On Thu, Jul 24, 2014 at 9:18 AM, Doug Cutting <cutt...@apache.org> wrote: > On Thu, Jul 24, 2014 at 7:23 AM, Echo <echo...@gmail.com> wrote: > > The avro library can't read the file with that 'union' schema, so I > wonder: > > With which Avro library can't you read a file with a union schema? > Unions are a standard feature and every implementation should be able > to read a file with such a schema. > > You can view the file contents with the 'tojson' command line tool: > > java -jar /path/to/avro-tools.jar tojson --pretty myfile.avro > > (You can also use the 'getschema' command line tool to view the schema > of the file.) > > Doug >