How was this GenericDatumReader constructed?  Is it used to read from an Avro 
file or from something else? 

Note that you may have to set the "expected" schema separately from the actual 
schema.  Avro needs to know what the schema was when it was written, in the 
Avro data file this is persisted with it and automatically set when read.


On Aug 2, 2010, at 4:28 PM, Markus Weimer wrote:

> Hi,
> 
> I added the following line to a schema, recreated the static java classes
> for it and compiled my code:
> 
> {"name": "bias", "type":"double", "default":"0.0"}
> 
> When I now try to read a file written before the change, I get an error:
> 
> Exception in thread "main" java.io.EOFException
>        at 
> org.apache.avro.io.BinaryDecoder.readDouble(BinaryDecoder.java:154)
>        at 
> org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:82)
>        at 
> org.apache.avro.generic.GenericDatumReader.readArray(GenericDatumReader.java
> :273)
>        at 
> org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:74)
>        at 
> org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.jav
> a:154)
>        at 
> org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:72)
>        at 
> org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:61)
> 
> 
> I assumed that it would just return 0.0 for the fields not present in the
> file. Is this a bug on my end?
> 
> Thanks,
> 
> Markus
> 

Reply via email to