public abstract class AccumulatorV2<IN,OUT>
extends Object
implements scala.Serializable
IN
, and produce output of
type OUT
.
OUT
should be a type that can be read atomically (e.g., Int, Long), or thread-safely
(e.g., synchronized collections) because it will be read from other threads.
Constructor and Description |
---|
AccumulatorV2() |
Modifier and Type | Method and Description |
---|---|
abstract void |
add(IN v)
Takes the inputs and accumulates.
|
abstract AccumulatorV2<IN,OUT> |
copy()
Creates a new copy of this accumulator.
|
AccumulatorV2<IN,OUT> |
copyAndReset()
Creates a new copy of this accumulator, which is zero value.
|
long |
id()
Returns the id of this accumulator, can only be called after registration.
|
boolean |
isRegistered()
Returns true if this accumulator has been registered.
|
abstract boolean |
isZero()
Returns if this accumulator is zero value or not.
|
abstract void |
merge(AccumulatorV2<IN,OUT> other)
Merges another same-type accumulator into this one and update its state, i.e.
|
scala.Option<String> |
name()
Returns the name of this accumulator, can only be called after registration.
|
abstract void |
reset()
Resets this accumulator, which is zero value.
|
String |
toString() |
abstract OUT |
value()
Defines the current value of this accumulator
|
public final boolean isRegistered()
public final long id()
public final scala.Option<String> name()
public abstract boolean isZero()
public AccumulatorV2<IN,OUT> copyAndReset()
isZero
on the copy
must return true.public abstract AccumulatorV2<IN,OUT> copy()
public abstract void reset()
isZero
must
return true.public abstract void add(IN v)
v
- (undocumented)public abstract void merge(AccumulatorV2<IN,OUT> other)
other
- (undocumented)public abstract OUT value()
public String toString()
toString
in class Object