Class ValueHistogram
java.lang.Object
org.apache.hadoop.mapreduce.lib.aggregate.ValueHistogram
- All Implemented Interfaces:
ValueAggregator<String>
- Direct Known Subclasses:
ValueHistogram
This class implements a value aggregator that computes the
histogram of a sequence of strings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNextValue(Object val) add the given val to the aggregator.voidreset()reset the aggregator
-
Constructor Details
-
ValueHistogram
public ValueHistogram()
-
-
Method Details
-
addNextValue
add the given val to the aggregator.- Specified by:
addNextValuein interfaceValueAggregator<String>- 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
- Specified by:
getReportin interfaceValueAggregator<String>- 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
- Returns:
- a string representation of the list of value/frequence pairs of the histogram
-
getCombinerOutput
- Specified by:
getCombinerOutputin interfaceValueAggregator<String>- Returns:
- a list value/frequence pairs. The return value is expected to be used by the reducer.
-
getReportItems
- Returns:
- a TreeMap representation of the histogram
-
reset
public void reset()reset the aggregator- Specified by:
resetin interfaceValueAggregator<String>
-