Class ValueHistogram

java.lang.Object
org.apache.hadoop.mapreduce.lib.aggregate.ValueHistogram
All Implemented Interfaces:
ValueAggregator<String>
Direct Known Subclasses:
ValueHistogram

@Public @Stable public class ValueHistogram extends Object implements ValueAggregator<String>
This class implements a value aggregator that computes the histogram of a sequence of strings.
  • Constructor Details

    • ValueHistogram

      public ValueHistogram()
  • Method Details

    • 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>