Exemplo n.º 1
0
 /* (non-Javadoc)
  * @see org.apache.hadoop.mapreduce.Reducer#reduce(KEYIN, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)
  */
 protected void reduce(TextPair key, Iterable<IntWritable> values, Context context)
     throws IOException, InterruptedException {
   sum = count = 0;
   for (IntWritable value : values) {
     sum += value.get();
     ++count;
   }
   avRatingDiff = sum / count;
   valueOut.set(key.toString() + fieldDelim + avRatingDiff + fieldDelim + count);
   context.write(NullWritable.get(), valueOut);
 }