Package com.gengoai.stream.spark
Class SparkMMultiCounterAccumulator<K1,K2>
- java.lang.Object
-
- com.gengoai.stream.spark.SparkMAccumulator<Tuple2<K1,K2>,MultiCounter<K1,K2>>
-
- com.gengoai.stream.spark.SparkMMultiCounterAccumulator<K1,K2>
-
- Type Parameters:
K1
- the first key type parameter of the MultiCounterK2
- the second key type parameter of the MultiCounter
- All Implemented Interfaces:
MAccumulator<Tuple2<K1,K2>,MultiCounter<K1,K2>>
,MMultiCounterAccumulator<K1,K2>
,Serializable
public class SparkMMultiCounterAccumulator<K1,K2> extends SparkMAccumulator<Tuple2<K1,K2>,MultiCounter<K1,K2>> implements MMultiCounterAccumulator<K1,K2>
An implementation of a
MMultiCounterAccumulator
for Spark streams- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.gengoai.stream.spark.SparkMAccumulator
accumulatorV2
-
-
Constructor Summary
Constructors Constructor Description SparkMMultiCounterAccumulator(String name)
Instantiates a new Spark SparkMMultiCounterAccumulator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
increment(K1 firstKey, K2 secondKey)
Increments the count of the two keys.void
increment(K1 firstKey, K2 secondKey, double value)
Increments the count of the two keys by the given value.void
merge(MultiCounter<K1,K2> other)
Merges the given MultiCounter with this accumulator-
Methods inherited from class com.gengoai.stream.spark.SparkMAccumulator
add, isZero, merge, name, register, reset, value
-
-
-
-
Constructor Detail
-
SparkMMultiCounterAccumulator
public SparkMMultiCounterAccumulator(String name)
Instantiates a new Spark SparkMMultiCounterAccumulator.- Parameters:
name
- the name of the accumulator
-
-
Method Detail
-
merge
public void merge(MultiCounter<K1,K2> other)
Description copied from interface:MMultiCounterAccumulator
Merges the given MultiCounter with this accumulator- Specified by:
merge
in interfaceMMultiCounterAccumulator<K1,K2>
- Parameters:
other
- the MultiCounter to merge
-
increment
public void increment(K1 firstKey, K2 secondKey)
Description copied from interface:MMultiCounterAccumulator
Increments the count of the two keys.- Specified by:
increment
in interfaceMMultiCounterAccumulator<K1,K2>
- Parameters:
firstKey
- the first keysecondKey
- the second key
-
increment
public void increment(K1 firstKey, K2 secondKey, double value)
Description copied from interface:MMultiCounterAccumulator
Increments the count of the two keys by the given value.- Specified by:
increment
in interfaceMMultiCounterAccumulator<K1,K2>
- Parameters:
firstKey
- the first keysecondKey
- the second keyvalue
- the amount to increment by
-
-