Class CollectionAccumulator<T>

Object
org.apache.spark.util.AccumulatorV2<T,List<T>>
org.apache.spark.util.CollectionAccumulator<T>
All Implemented Interfaces:
Serializable, scala.Serializable

public class CollectionAccumulator<T> extends AccumulatorV2<T,List<T>>
An accumulator for collecting a list of elements.

Since:
2.0.0
See Also:
  • Constructor Details

    • CollectionAccumulator

      public CollectionAccumulator()
  • Method Details

    • add

      public void add(T v)
      Description copied from class: AccumulatorV2
      Takes the inputs and accumulates.
      Specified by:
      add in class AccumulatorV2<T,List<T>>
      Parameters:
      v - (undocumented)
    • copy

      public CollectionAccumulator<T> copy()
      Description copied from class: AccumulatorV2
      Creates a new copy of this accumulator.
      Specified by:
      copy in class AccumulatorV2<T,List<T>>
      Returns:
      (undocumented)
    • copyAndReset

      public CollectionAccumulator<T> copyAndReset()
      Description copied from class: AccumulatorV2
      Creates a new copy of this accumulator, which is zero value. i.e. call isZero on the copy must return true.
      Overrides:
      copyAndReset in class AccumulatorV2<T,List<T>>
      Returns:
      (undocumented)
    • isZero

      public boolean isZero()
      Returns false if this accumulator instance has any values in it.
      Specified by:
      isZero in class AccumulatorV2<T,List<T>>
      Returns:
      (undocumented)
    • merge

      public void merge(AccumulatorV2<T,List<T>> other)
      Description copied from class: AccumulatorV2
      Merges another same-type accumulator into this one and update its state, i.e. this should be merge-in-place.
      Specified by:
      merge in class AccumulatorV2<T,List<T>>
      Parameters:
      other - (undocumented)
    • reset

      public void reset()
      Description copied from class: AccumulatorV2
      Resets this accumulator, which is zero value. i.e. call isZero must return true.
      Specified by:
      reset in class AccumulatorV2<T,List<T>>
    • value

      public List<T> value()
      Description copied from class: AccumulatorV2
      Defines the current value of this accumulator
      Specified by:
      value in class AccumulatorV2<T,List<T>>
      Returns:
      (undocumented)