avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Haviv <daniel.ha...@veracity-group.com>
Subject java.io.IOException: Invalid long encoding
Date Sun, 27 Sep 2015 10:27:51 GMT
Hi,
I'm trying to read an avro file using the following scala code:
 val zibi= scala.io.Source.fromFile("/home/wasabi/schema").mkString
 val schema_obj =  new Schema.Parser
 val schema2 = schema_obj.parse(zibi)
 val READER2 = new GenericDatumReader[GenericRecord](schema2)
 val myFile =
Files.readAllBytes(Paths.get("/tmp/check/CMRF_80_1442744555901-1_1_2_1_1_1_4_10_1.avro"))
 val datum = READER2.read(null,
DecoderFactory.defaultFactory.createBinaryDecoder(myFile,null))

The reader is failing on
java.io.IOException: Invalid long encoding
        at
org.apache.avro.io.BinaryDecoder.innerLongDecode(BinaryDecoder.java:217)
        at org.apache.avro.io.BinaryDecoder.readLong(BinaryDecoder.java:176)
        at
org.apache.avro.io.ResolvingDecoder.readLong(ResolvingDecoder.java:162)
        at
org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:160)
        at
org.apache.avro.generic.GenericDatumReader.readField(GenericDatumReader.java:193)
        at
org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:183)
        at
org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:151)
        at
org.apache.avro.generic.GenericDatumReader.readArray(GenericDatumReader.java:219)
        at
org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:153)
        at
org.apache.avro.generic.GenericDatumReader.readField(GenericDatumReader.java:193)
        at
org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:183)
        at
org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:151)
        at
org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:142)

avro-tools is successful in reading the file.

anyone else has encountered this ?

Thank you.
Daniel

Mime
View raw message