I am trying to write mapreducer program for the following problem.
Problem:
- Determine the length of each tweet that is stored in csv file
- how many time a particular length of tweet occur
- Compute their averages
The custome writable(Pair)below was also given. Assume the Pair is fully implemented. How can I use the custom writable (Pair) in the mapper to tackle the problems?
I can tackle the problem without using the custom Writable(Pair) by simplying parsing the text and determine the length of each tweet in the mapper. The key would be the length (int) and the value would be the occurance of a particular length. Then, passing them to the reducer. However, if i wanted to use the Pair custom writable in the mapper, how can I do that? Please explain to me how can achieve this.
`public class Pair implements WritableComparable {
private IntWritable a;
private IntWritable b;
public Pair()
{}
public Pair(int a, int b)
{}
...
...
}`