Class LongCounter
- java.lang.Object
-
- org.apache.flink.api.common.accumulators.LongCounter
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Accumulator<Long,Long>
,SimpleAccumulator<Long>
@PublicEvolving public class LongCounter extends Object implements SimpleAccumulator<Long>
An accumulator that sums uplong
values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LongCounter()
LongCounter(long value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(long value)
void
add(Long value)
Consider usingadd(long)
instead for primitive long valuesLongCounter
clone()
Duplicates the accumulator.Long
getLocalValue()
long
getLocalValuePrimitive()
void
merge(Accumulator<Long,Long> 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(Long value)
Consider usingadd(long)
instead for primitive long values- Specified by:
add
in interfaceAccumulator<Long,Long>
- Parameters:
value
- The value to add to the accumulator object
-
getLocalValue
public Long getLocalValue()
- Specified by:
getLocalValue
in interfaceAccumulator<Long,Long>
- Returns:
- local The local value from the current UDF context
-
merge
public void merge(Accumulator<Long,Long> 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<Long,Long>
- Parameters:
other
- Reference to accumulator to merge in.
-
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<Long,Long>
-
clone
public LongCounter clone()
Description copied from interface:Accumulator
Duplicates the accumulator. All subclasses need to properly implement cloning and cannot throw aCloneNotSupportedException
-
add
public void add(long value)
-
getLocalValuePrimitive
public long getLocalValuePrimitive()
-
-