Interface Accumulator<V,R extends Serializable>
-
- Type Parameters:
V
- Type of values that are added to the accumulatorR
- Type of the accumulator result as it will be reported to the client
- All Superinterfaces:
Cloneable
,Serializable
- All Known Subinterfaces:
SimpleAccumulator<T>
- All Known Implementing Classes:
AverageAccumulator
,DoubleCounter
,DoubleMaximum
,DoubleMinimum
,Histogram
,IntCounter
,IntMaximum
,IntMinimum
,ListAccumulator
,LongCounter
,LongMaximum
,LongMinimum
,SerializedListAccumulator
,Utils.ChecksumHashCode
@Public public interface Accumulator<V,R extends Serializable> extends Serializable, Cloneable
Accumulators collect distributed statistics or aggregates in a from user functions and operators. Each parallel instance creates and updates its own accumulator object, and the different parallel instances of the accumulator are later merged. merged by the system at the end of the job. The result can be obtained from the result of a job execution, or from the web runtime monitor.The accumulators are inspired by the Hadoop/MapReduce counters.
The type added to the accumulator might differ from the type returned. This is the case e.g. for a set-accumulator: We add single objects, but the result is a set of objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(V value)
Accumulator<V,R>
clone()
Duplicates the accumulator.R
getLocalValue()
void
merge(Accumulator<V,R> other)
Used by system internally to merge the collected parts of an accumulator at the end of the job.void
resetLocal()
Reset the local value.
-
-
-
Method Detail
-
add
void add(V value)
- Parameters:
value
- The value to add to the accumulator object
-
getLocalValue
R getLocalValue()
- Returns:
- local The local value from the current UDF context
-
resetLocal
void resetLocal()
Reset the local value. This only affects the current UDF context.
-
merge
void merge(Accumulator<V,R> other)
Used by system internally to merge the collected parts of an accumulator at the end of the job.- Parameters:
other
- Reference to accumulator to merge in.
-
clone
Accumulator<V,R> clone()
Duplicates the accumulator. All subclasses need to properly implement cloning and cannot throw aCloneNotSupportedException
- Returns:
- The duplicated accumulator.
-
-