org.apache.hadoop.mapred.lib.aggregate
Class ValueHistogram

java.lang.Object
  extended by org.apache.hadoop.mapred.lib.aggregate.ValueHistogram
All Implemented Interfaces:
ValueAggregator

public class ValueHistogram
extends Object
implements ValueAggregator

This class implements a value aggregator that computes the histogram of a sequence of strings.


Constructor Summary
ValueHistogram()
           
 
Method Summary
 void addNextValue(Object val)
          add the given val to the aggregator.
 ArrayList getCombinerOutput()
           
 String getReport()
           
 String getReportDetails()
           
 TreeMap getReportItems()
           
 void reset()
          reset the aggregator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueHistogram

public ValueHistogram()
Method Detail

addNextValue

public void addNextValue(Object val)
add the given val to the aggregator.

Specified by:
addNextValue in interface ValueAggregator
Parameters:
val - the value to be added. It is expected to be a string in the form of xxxx\tnum, meaning xxxx has num occurrences.

getReport

public String getReport()
Specified by:
getReport in interface ValueAggregator
Returns:
the string representation of this aggregator. It includes the following basic statistics of the histogram: the number of unique values the minimum value the media value the maximum value the average value the standard deviation

getReportDetails

public String getReportDetails()
Returns:
a string representation of the list of value/frequence pairs of the histogram

getCombinerOutput

public ArrayList getCombinerOutput()
Specified by:
getCombinerOutput in interface ValueAggregator
Returns:
a list value/frequence pairs. The return value is expected to be used by the reducer.

getReportItems

public TreeMap getReportItems()
Returns:
a TreeMap representation of the histogram

reset

public void reset()
reset the aggregator

Specified by:
reset in interface ValueAggregator


Copyright © 2009 The Apache Software Foundation