0

I am trying to write mapreducer program for the following problem.

Problem:

  1. Determine the length of each tweet that is stored in csv file
  2. how many time a particular length of tweet occur
  3. 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) 
   {}
    ...
    ...

}`
elyon
  • 37
  • 6
  • 1
    Welcome to stackoverflow. Open ended questions are discouraged on stackoverflow as per [What types of questions should I avoid asking?](http://stackoverflow.com/help/dont-ask). A better question would be to show your work and indicate where you are stuck. See [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). That is, make an attempt at using Pair custom writable in the mapper, show your code and run outputs then indicate where you are having difficulty. – MikeJRamsey56 Nov 05 '16 at 02:54
  • Hi, you should read a little more about MapReduce! I recommend for you the guide of Apache Hadoop (See the Word count example). Then, you can easily write your code, in case of error we are here to help you, welcome! – Imi.Cino Mar 19 '17 at 23:36

0 Answers0