org.apache.hadoop.examples
Class PiEstimator.PiReducer

java.lang.Object
  extended by org.apache.hadoop.mapred.MapReduceBase
      extended by org.apache.hadoop.examples.PiEstimator.PiReducer
All Implemented Interfaces:
Closeable, JobConfigurable, Reducer<BooleanWritable,LongWritable,WritableComparable<?>,Writable>
Enclosing class:
PiEstimator

public static class PiEstimator.PiReducer
extends MapReduceBase
implements Reducer<BooleanWritable,LongWritable,WritableComparable<?>,Writable>

Reducer class for Pi estimation. Accumulate points inside/outside results from the mappers.


Constructor Summary
PiEstimator.PiReducer()
           
 
Method Summary
 void close()
          Reduce task done, write output to a file.
 void configure(JobConf job)
          Store job configuration.
 void reduce(BooleanWritable isInside, Iterator<LongWritable> values, OutputCollector<WritableComparable<?>,Writable> output, Reporter reporter)
          Accumulate number of points inside/outside results from the mappers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PiEstimator.PiReducer

public PiEstimator.PiReducer()
Method Detail

configure

public void configure(JobConf job)
Store job configuration.

Specified by:
configure in interface JobConfigurable
Overrides:
configure in class MapReduceBase
Parameters:
job - the configuration

reduce

public void reduce(BooleanWritable isInside,
                   Iterator<LongWritable> values,
                   OutputCollector<WritableComparable<?>,Writable> output,
                   Reporter reporter)
            throws IOException
Accumulate number of points inside/outside results from the mappers.

Specified by:
reduce in interface Reducer<BooleanWritable,LongWritable,WritableComparable<?>,Writable>
Parameters:
isInside - Is the points inside?
values - An iterator to a list of point counts
output - dummy, not used here.
reporter -
Throws:
IOException

close

public void close()
           throws IOException
Reduce task done, write output to a file.

Specified by:
close in interface Closeable
Overrides:
close in class MapReduceBase
Throws:
IOException


Copyright © 2009 The Apache Software Foundation