hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Devaraj k <devara...@huawei.com>
Subject RE: objects as key/values
Date Tue, 30 Jul 2013 02:43:59 GMT
You can write custom key/value classes by implementing org.apache.hadoop.io.Writable interface
for your Job.


Devaraj k

From: jamal sasha [mailto:jamalshasha@gmail.com]
Sent: 30 July 2013 10:27
To: user@hadoop.apache.org
Subject: objects as key/values

  A very basic (stupid) question.
I am trying to compute mean using hadoop.

So my implementation is like this:

public class Mean
 public static class Pair{
  //simple class to create object
 public class MeanMapper<LongWritable, Text,Text, Pair>
   emit(text,pair) //where pair is (local sum, count)

 public class MeanReducer<Text, Pair, Text DoubleWritable>
    emit (text, mean)

Unfortunately such approach of creating custom class types are not working
since in job I have to set the output type for mapper/reducer...
How are custom key values pair implemented in hadoop?

View raw message