Class UniqValueCount

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

@Public @Stable public class UniqValueCount extends Object implements ValueAggregator<Object>
This class implements a value aggregator that dedupes a sequence of objects.
  • Field Details

  • Constructor Details

    • UniqValueCount

      public UniqValueCount()
      the default constructor
    • UniqValueCount

      public UniqValueCount(long maxNum)
      constructor
      Parameters:
      maxNum - the limit in the number of unique values to keep.
  • Method Details

    • setMaxItems

      public long setMaxItems(long n)
      Set the limit on the number of unique values
      Parameters:
      n - the desired limit on the number of unique values
      Returns:
      the new limit on the number of unique values
    • addNextValue

      public void addNextValue(Object val)
      add a value to the aggregator
      Specified by:
      addNextValue in interface ValueAggregator<Object>
      Parameters:
      val - an object.
    • getReport

      public String getReport()
      Specified by:
      getReport in interface ValueAggregator<Object>
      Returns:
      return the number of unique objects aggregated
    • getUniqueItems

      public Set<Object> getUniqueItems()
      Returns:
      the set of the unique objects
    • reset

      public void reset()
      reset the aggregator
      Specified by:
      reset in interface ValueAggregator<Object>
    • getCombinerOutput

      public ArrayList<Object> getCombinerOutput()
      Specified by:
      getCombinerOutput in interface ValueAggregator<Object>
      Returns:
      return an array of the unique objects. The return value is expected to be used by the a combiner.