Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Avro, mail # user - Re: Problem: java.io.IOException: java.lang.ArrayIndexOutOfBoundsException: 64 / avro.io.SchemaResolutionException: Can't access branch index 64 for union with 2 branches / `read_data': Writer's schema and Reader's schema ["string","null"] do not mat


+
Russell Jurney 2012-03-24, 03:27
Copy link to this message
-
Re: Problem: java.io.IOException: java.lang.ArrayIndexOutOfBoundsException: 64 / avro.io.SchemaResolutionException: Can't access branch index 64 for union with 2 branches / `read_data': Writer's schema and Reader's schema ["string","null"] do not mat
Scott Carey 2012-03-26, 15:55
Avro Java's file writer[1] (the last several versions) rewinds its buffer if
there is an exception during writing, so if there are writes afterwords the
file will not be corrupt.  However, most tools are not so careful.

[1] DataFileWriter.append()
http://svn.apache.org/repos/asf/avro/trunk/lang/java/avro/src/main/java/org/
apache/avro/file/DataFileWriter.java
On 3/23/12 8:27 PM, "Russell Jurney" <[EMAIL PROTECTED]> wrote:

> Ok, now I have a followup question...
>
> how does one recover from an exception writing an Avro?  The incomplete record
> is being written, which is crashing the reader.
>
> On Fri, Mar 23, 2012 at 8:01 PM, Russell Jurney <[EMAIL PROTECTED]>
> wrote:
>> Thanks Scott, looking at the raw data it seems to have been a truncated
>> record due to UTF problems.
>>
>> Russell Jurney http://datasyndrome.com
>>
>> On Mar 23, 2012, at 7:59 PM, Scott Carey <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> It appears to be reading a union index and failing in there somehow.  If it
>>> did not have any of the pig AvroStorage stuff in there I could tell you
>>> more.
>>>
>>> What does avro-tools.jar 's 'tojson' tool do?  (java ­jar
>>> avro-tools-1.6.3.jar tojson <file> | your_favorite_text_reader)
>>> What version of Avro is the java stack trace below?
>>>
>>>
>>> On 3/23/12 7:01 PM, "Russell Jurney" <[EMAIL PROTECTED]> wrote:
>>>
>>>> I have a problem record I've written in Avro that crashes anything which
>>>> tries to read it :(
>>>>
>>>> Can anyone make sense of these errors?
>>>>
>>>> The exception in Pig/AvroStorage is this:
>>>>
>>>>> java.io.IOException: java.lang.ArrayIndexOutOfBoundsException: 64
>>>>> at
>>>>> org.apache.pig.piggybank.storage.avro.AvroStorage.getNext(AvroStorage.java
>>>>> :275)
>>>>> at
>>>>> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigRecordRead
>>>>> er.nextKeyValue(PigRecordReader.java:187)
>>>>> at
>>>>> org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapT
>>>>> ask.java:532)
>>>>> at
>>>>> org.apache.avro.io.parsing.Symbol$Alternative.getSymbol(Symbol.java:364)
>>>>> at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:229)
>>>>> at org.apache.avro.io.parsing.Parser.advance(Parser.java:88)
>>>>> at
>>>>> org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:206)
>>>>> at
>>>>> org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:14
>>>>> 2)
>>>>> at
>>>>> org.apache.pig.piggybank.storage.avro.PigAvroDatumReader.readRecord(PigAvr
>>>>> oDatumReader.java:67)
>>>>> at
>>>>> org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:13
>>>>> 8)
>>>>> at
>>>>> org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:12
>>>>> 9)
>>>>> at org.apache.avro.file.DataFileStream.next(DataFileStream.java:233)
>>>>> at org.apache.avro.file.DataFileStream.next(DataFileStream.java:220)
>>>>> at
>>>>> org.apache.pig.piggybank.storage.avro.PigAvroRecordReader.getCurrentValue(
>>>>> PigAvroRecordReader.java:80)
>>>>> at
>>>>> org.apache.pig.piggybank.storage.avro.AvroStorage.getNext(AvroStorage.java
>>>>> :273)
>>>>> ... 7 more
>>>>
>>>> When reading the record in Python:
>>>>
>>>>> File "/me/Collecting-Data/src/python/cat_avro", line 21, in <module>
>>>>>     for record in df_reader:
>>>>>   File
>>>>> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
>>>>> /site-packages/avro-_AVRO_VERSION_-py2.6.egg/avro/datafile.py", line 354,
>>>>> in next
>>>>>     datum = self.datum_reader.read(self.datum_decoder)
>>>>>   File
>>>>> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
>>>>> /site-packages/avro-_AVRO_VERSION_-py2.6.egg/avro/io.py", line 445, in
>>>>> read
>>>>>     return self.read_data(self.writers_schema, self.readers_schema,
>>>>> decoder)
>>>>>   File
>>>>> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
>>>>> /site-packages/avro-_AVRO_VERSION_-py2.6.egg/avro/io.py", line 490, in
+
Russell Jurney 2012-03-24, 02:01
+
Scott Carey 2012-03-24, 02:59
+
Russell Jurney 2012-03-24, 03:01