Class AverageAccumulator
- java.lang.Object
-
- org.apache.flink.api.common.accumulators.AverageAccumulator
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Accumulator<Double,Double>
,SimpleAccumulator<Double>
@Public public class AverageAccumulator extends Object implements SimpleAccumulator<Double>
An accumulator that computes the average value. Input can belong
,integer
, ordouble
and the result isdouble
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AverageAccumulator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(double value)
void
add(int value)
void
add(long value)
void
add(Double value)
AverageAccumulator
clone()
Duplicates the accumulator.Double
getLocalValue()
void
merge(Accumulator<Double,Double> 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.String
toString()
-
-
-
Method Detail
-
add
public void add(Double value)
- Specified by:
add
in interfaceAccumulator<Double,Double>
- Parameters:
value
- The value to add to the accumulator object
-
add
public void add(double value)
-
add
public void add(long value)
-
add
public void add(int value)
-
getLocalValue
public Double getLocalValue()
- Specified by:
getLocalValue
in interfaceAccumulator<Double,Double>
- Returns:
- local The local value from the current UDF context
-
resetLocal
public void resetLocal()
Description copied from interface:Accumulator
Reset the local value. This only affects the current UDF context.- Specified by:
resetLocal
in interfaceAccumulator<Double,Double>
-
merge
public void merge(Accumulator<Double,Double> other)
Description copied from interface:Accumulator
Used by system internally to merge the collected parts of an accumulator at the end of the job.- Specified by:
merge
in interfaceAccumulator<Double,Double>
- Parameters:
other
- Reference to accumulator to merge in.
-
clone
public AverageAccumulator clone()
Description copied from interface:Accumulator
Duplicates the accumulator. All subclasses need to properly implement cloning and cannot throw aCloneNotSupportedException
-
-