The default implementation does nothing void run context ioexception
Processing – MapReduce and Beyond
Notice that the map method only refers to a single instance of K1 and V1 key/value pairs. This is a critical aspect of the MapReduce paradigm in which you write classes that process single records, and the framework is responsible for all the work required to turn an enormous dataset into a stream of key/value pairs. You will never have to write map or reduce classes that try to deal with the full dataset. Hadoop also provides mechanisms through its InputFormat and OutputFormat classes that provide implementations of common file formats and likewise remove the need for having to write file parsers for any but custom file types.
protected void cleanup( Mapper.Context context)
throws IOException, InterruptedException
The Reducer class
The Reducer base class works very similarly to the Mapper class and usually requires only subclasses to override a single reduce() method. Here is the cut-down class definition:
throws IOException, InterruptedException
...
This class also has the setup, run and cleanup methods with similar default implementations as with the Mapper class that can optionally be overridden:
protected void setup(Reducer.Context context)
The cleanup() method is called once after all key/lists of values have been presented to the reduce method. The default implementation does nothing:
protected void run(Reducer.Context context)
The driver logic usually exists in the main method of the class written to encapsulate a MapReduce job. There is no default parent Driver class to subclass:
public class ExampleDriver extends Configured implements Tool
// Create a Configuration object that is used to set other options
[ 63 ]