Class LongValueSum
java.lang.Object
org.apache.hadoop.mapreduce.lib.aggregate.LongValueSum
- All Implemented Interfaces:
ValueAggregator<String>
- Direct Known Subclasses:
LongValueSum
This class implements a value aggregator that sums up
a sequence of long values.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNextValue(long val) add a value to the aggregatorvoidaddNextValue(Object val) add a value to the aggregatorlonggetSum()voidreset()reset the aggregator
-
Constructor Details
-
LongValueSum
public LongValueSum()the default constructor
-
-
Method Details
-
addNextValue
add a value to the aggregator- Specified by:
addNextValuein interfaceValueAggregator<String>- Parameters:
val- an object whose string representation represents a long value.
-
addNextValue
public void addNextValue(long val) add a value to the aggregator- Parameters:
val- a long value.
-
getSum
public long getSum()- Returns:
- the aggregated value
-
getReport
- Specified by:
getReportin interfaceValueAggregator<String>- Returns:
- the string representation of the aggregated value
-
reset
public void reset()reset the aggregator- Specified by:
resetin interfaceValueAggregator<String>
-
getCombinerOutput
- Specified by:
getCombinerOutputin interfaceValueAggregator<String>- Returns:
- return an array of one element. The element is a string representation of the aggregated value. The return value is expected to be used by the a combiner.
-