avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terry Healy <the...@bnl.gov>
Subject Re: Getting ClassCastException while using GenericRecord in Mapper
Date Mon, 14 Jan 2013 19:07:05 GMT
Pratysuh-

First a HUGE caution that I am an AVRO M/R beginner, but I faced a
similar issue. I think that you are not extending AvroMapper as intended.

Here is a part of my similar code wich runs:

    public static class AvroFlowMapper<K> extends AvroMapper<K,
Pair<Long, GenericRecord>> {


        private GenericRecord genRec = new
GenericData.Record(NETFLOW_V5_SCHEMA);


        @Override
        public void map(K datum, AvroCollector<Pair<Long,
GenericRecord>> collector,
                Reporter reporter) throws IOException {

            genRec = (GenericRecord) datum;
            AvroFlowWritable afw = new AvroFlowWritable(genRec);
	    //....
Where AvroFlowWritable is my class as the content of which is described
by NETFLOW_V5_SCHEMA.

Again, others will certainly have better explanation / examples. I hope
this helps you get started.

-Terry

	

On 01/14/2013 08:33 AM, Pratyush Chandra wrote:
> 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));
>         }
>     }

Mime
View raw message