The results and ramblings of research

phewww!

MR and Avro – Passing Avro through Pairs

leave a comment »

The mapper class is as follows:



public static class ReadData extends Mapper<AvroKey<XYZ>,NullWritable, Text, AvroValue<Pair>>{
      private final Text keyOut = new Text();
      private final AvroValue<Pair> valOut = new AvroValue<>();
      protected void map(AvroKey<XYZ>; key, NullWritable value, Context context) throws IOException, InterruptedException {
           XYZ data = key.datum();
           keyOut.set(data.getKey());
           valOut.datum(new Pair<CharSequence, XYZ>(data.getOtherKey(), data));
           context.write(keyOut, valOut);
      }
}

Advertisements

Written by anujjaiswal

April 20, 2015 at 5:03 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: