Class UniqValueCount
java.lang.Object
org.apache.hadoop.mapreduce.lib.aggregate.UniqValueCount
- All Implemented Interfaces:
ValueAggregator<Object>
- Direct Known Subclasses:
UniqValueCount
This class implements a value aggregator that dedupes a sequence of objects.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNextValue(Object val) add a value to the aggregatorvoidreset()reset the aggregatorlongsetMaxItems(long n) Set the limit on the number of unique values
-
Field Details
-
MAX_NUM_UNIQUE_VALUES
- See Also:
-
-
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
add a value to the aggregator- Specified by:
addNextValuein interfaceValueAggregator<Object>- Parameters:
val- an object.
-
getReport
- Specified by:
getReportin interfaceValueAggregator<Object>- Returns:
- return the number of unique objects aggregated
-
getUniqueItems
- Returns:
- the set of the unique objects
-
reset
public void reset()reset the aggregator- Specified by:
resetin interfaceValueAggregator<Object>
-
getCombinerOutput
- Specified by:
getCombinerOutputin interfaceValueAggregator<Object>- Returns:
- return an array of the unique objects. The return value is expected to be used by the a combiner.
-