UnpackedAvroSource

26 views
Skip to first unread message

rot...@liveperson.com

unread,
Apr 22, 2015, 7:41:59 AM4/22/15
to cascadi...@googlegroups.com
I'm using UnpackedAvroSource in my scalding job with intentions to use GenericData (I worked around the hashCode bug of AvroScheme)
But I get the following odd behavior:

Caused by: java.lang.ClassCastException: com.l.g.ah cannot be cast to com.l.g.ch   (ah and ch are both my classes)
at com.l.g.event.put(LPEvent.java:60)
	at org.apache.avro.generic.GenericData.setField(GenericData.java:530)
	at org.apache.avro.generic.GenericData.setField(GenericData.java:547)
	at org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:177)
	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:148)
	at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:139)
	at org.apache.avro.file.DataFileStream.next(DataFileStream.java:233)

Why is the GenericDatumReader attempts to set a field on com.l.g.event and not on GenericData$Record ?? That is the entire point of using generics.
I did not explicitly set this class anywhere - the only thing I can think of is that it realizes the existence of the object from the avro data itself (using namespace: and name: attributes)

My code is simple as :
UnpackedAvroSource[Tuple](avroPaths, schema).read
        .mapTo('event-> 'header) { audHeaders: util.ArrayList[Tuple] => ... }

This message may contain confidential and/or privileged information. 
If you are not the addressee or authorized to receive this on behalf of the addressee you must not use, copy, disclose or take action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply email and delete this message. Thank you.
Reply all
Reply to author
Forward
0 new messages