org.apache.hadoop.examples
Class WordMean.WordMeanReducer

java.lang.Object
  extended by org.apache.hadoop.mapreduce.Reducer<org.apache.hadoop.io.Text,org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,org.apache.hadoop.io.LongWritable>
      extended by org.apache.hadoop.examples.WordMean.WordMeanReducer
Enclosing class:
WordMean

public static class WordMean.WordMeanReducer
extends org.apache.hadoop.mapreduce.Reducer<org.apache.hadoop.io.Text,org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,org.apache.hadoop.io.LongWritable>

Performs integer summation of all the values for each key.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.mapreduce.Reducer
org.apache.hadoop.mapreduce.Reducer.Context
 
Constructor Summary
WordMean.WordMeanReducer()
           
 
Method Summary
 void reduce(org.apache.hadoop.io.Text key, Iterable<org.apache.hadoop.io.LongWritable> values, org.apache.hadoop.mapreduce.Reducer.Context context)
          Sums all the individual values within the iterator and writes them to the same key.
 
Methods inherited from class org.apache.hadoop.mapreduce.Reducer
cleanup, run, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordMean.WordMeanReducer

public WordMean.WordMeanReducer()
Method Detail

reduce

public void reduce(org.apache.hadoop.io.Text key,
                   Iterable<org.apache.hadoop.io.LongWritable> values,
                   org.apache.hadoop.mapreduce.Reducer.Context context)
            throws IOException,
                   InterruptedException
Sums all the individual values within the iterator and writes them to the same key.

Overrides:
reduce in class org.apache.hadoop.mapreduce.Reducer<org.apache.hadoop.io.Text,org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text,org.apache.hadoop.io.LongWritable>
Parameters:
key - This will be one of 2 constants: LENGTH_STR or COUNT_STR.
values - This will be an iterator of all the values associated with that key.
Throws:
IOException
InterruptedException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.