avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milind Vaidya <kava...@gmail.com>
Subject Avro Byte Blob Ser De
Date Tue, 11 Feb 2014 18:15:19 GMT
I am trying to serialize and read byte blob with Byte Schema as follows

static final org.apache.avro.Schema byteBlobSchema =
org.apache.avro.Schema.create(org.apache.avro.Schema.Type.BYTES);


The writing part works fine and I can serialize data. The problem is with
reading.

GenericDatumReader rdata = new GenericDatumReader(byteBlobSchema);

DataFileReader dataFileReader = new DataFileReader(path, rdata);

GenericData.Record record = new GenericData.Record(byteBlobSchema);

while(dataFileReader.hasNext()) {

       dataFileReader.next(record);

}

This gives error as: Not a record schema: "bytes"

There is something like

public static final Schema.Type
<https://avro.apache.org/docs/1.4.1/api/java/org/apache/avro/Schema.Type.html>
*BYTES*

and I checked if that is the same thing I am getting if I call
byteBlobSchema.getType()

Is there something I am missing ? Please let me know if I need to give more
details about writing the the records.


- Milind

Mime
View raw message