Functions for working with Accumulator objects which can aggregate values across executors.
Functions for working with Accumulator objects which can aggregate values across executors.
(add! acc v)
Add an element to the accumulated value.
Add an element to the accumulated value.
(avg acc)
Return the average of all the values added to the accumulator. The accumulator must hold either long or double values.
Return the average of all the values added to the accumulator. The accumulator must hold either long or double values.
(collection-accumulator spark-context)
(collection-accumulator spark-context acc-name)
Create and register a collection accumulator, which starts with empty list and accumulates inputs by adding them into the list.
Create and register a collection accumulator, which starts with empty list and accumulates inputs by adding them into the list.
(count acc)
Return the number of values added to the accumulator. The accumulator must hold either long or double values.
Return the number of values added to the accumulator. The accumulator must hold either long or double values.
(double-accumulator spark-context)
(double-accumulator spark-context acc-name)
Create and register a double accumulator, which starts with 0.0 and accumulates inputs by summing them.
Create and register a double accumulator, which starts with 0.0 and accumulates inputs by summing them.
(empty? acc)
True if the accumulator has not had any values added to it.
True if the accumulator has not had any values added to it.
(long-accumulator spark-context)
(long-accumulator spark-context acc-name)
Create and register a long accumulator, which starts with 0 and accumulates inputs by summing them.
Create and register a long accumulator, which starts with 0 and accumulates inputs by summing them.
(merge! a b)
Merge an accumulator b
into a
. Both accumulators must have the same
type.
Merge an accumulator `b` into `a`. Both accumulators must have the same type.
(name acc)
Return the name of the accumulator, if any.
Return the name of the accumulator, if any.
(reset! acc)
Reset the accumulator to its empty or zero value.
Reset the accumulator to its empty or zero value.
(sum acc)
Return the sum of all the values added to the accumulator. The accumulator must hold either long or double values.
Return the sum of all the values added to the accumulator. The accumulator must hold either long or double values.
(value acc)
Return the current value of the accumulator. This can only be called by the driver.
Return the current value of the accumulator. This can only be called by the driver.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close