org.apache.hadoop.mapreduce.lib.aggregate
Class ValueHistogram
java.lang.Object
org.apache.hadoop.mapreduce.lib.aggregate.ValueHistogram
- All Implemented Interfaces:
- ValueAggregator<String>
- Direct Known Subclasses:
- ValueHistogram
@InterfaceAudience.Public
@InterfaceStability.Stable
public class ValueHistogram
- extends Object
- implements ValueAggregator<String>
This class implements a value aggregator that computes the
histogram of a sequence of strings.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ValueHistogram
public ValueHistogram()
addNextValue
public void addNextValue(Object val)
- add the given val to the aggregator.
- Specified by:
addNextValue
in interface ValueAggregator<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
public String getReport()
- Specified by:
getReport
in interface ValueAggregator<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
public String getReportDetails()
- Returns:
- a string representation of the list of value/frequence pairs of
the histogram
getCombinerOutput
public ArrayList<String> getCombinerOutput()
- Specified by:
getCombinerOutput
in interface ValueAggregator<String>
- Returns:
- a list value/frequence pairs.
The return value is expected to be used by the reducer.
getReportItems
public TreeMap<Object,Object> getReportItems()
- Returns:
- a TreeMap representation of the histogram
reset
public void reset()
- reset the aggregator
- Specified by:
reset
in interface ValueAggregator<String>
Copyright © 2014 Apache Software Foundation. All Rights Reserved.