Can somebody help me with this ? Thanks Pratyush
On Thu, Jan 10, 2013 at 1:16 AM, Pratyush Chandra < [email protected]> wrote: > Hi, > > I have a simple schema say: > > { > "namespace": "example.proto", > "name": "Message", "type": "record", > "fields": [ > {"name": "user", "type": ["string","null"]} > ] > } > > When I am running map reduce with following mapper : > public static class IdentityAvroMapper extends > AvroMapper<GenericRecord, Pair<GenericRecord, GenericRecord>> { > public void map(GenericRecord text, > AvroCollector<Pair<GenericRecord, GenericRecord>> > collector, Reporter reporter) throws IOException { > collector.collect(new Pair<GenericRecord, GenericRecord>(text, > text)); > } > } > > It throws me error "java.lang.ClassCastException: example.proto.Message > cannot be cast to org.apache.avro.generic.GenericRecord" > It works fine if I use Message (generated class) in place of GenericRecord. > > So, if I do not wish to use generated code, why am I not able to cast it > to GenericRecord. I want to be able to use map reduce with generic apis. > Any pointers please ? > > > Regards > Pratyush Chandra > -- Pratyush Chandra
