org.apache.spark

Accumulable

Related Doc: package spark

class Accumulable[R, T] extends Serializable

A data type that can be accumulated, ie has an commutative and associative "add" operation, but where the result type, R, may be different from the element type being added, T.

You must define how to add data, and how to merge two of these together. For some data types, such as a counter, these might be the same operation. In that case, you can use the simpler org.apache.spark.Accumulator. They won't always be the same, though -- e.g., imagine you are accumulating a set. You will add items to the set, and you will union two sets together.

R

the full accumulated data (result type)

T

partial data that can be added in

Linear Supertypes
Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Accumulable
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Accumulable(initialValue: R, param: AccumulableParam[R, T])

  2. new Accumulable(initialValue: R, param: AccumulableParam[R, T], name: Option[String])

    initialValue

    initial value of accumulator

    param

    helper object defining how to add elements of type R and T

    name

    human-readable name for use in Spark's web UI

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. def ++=(term: R): Unit

    Merge two accumulable objects together

    Merge two accumulable objects together

    Normally, a user will not want to use this version, but will instead call +=.

    term

    the other R that will get merged with this

  4. def +=(term: T): Unit

    Add more data to this accumulator / accumulable

    Add more data to this accumulator / accumulable

    term

    the data to add

  5. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  6. def add(term: T): Unit

    Add more data to this accumulator / accumulable

    Add more data to this accumulator / accumulable

    term

    the data to add

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. val id: Long

  15. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  16. def localValue: R

    Get the current value of this accumulator from within a task.

    Get the current value of this accumulator from within a task.

    This is NOT the global value of the accumulator. To get the global value after a completed operation on the dataset, call value.

    The typical use of this method is to directly mutate the local value, eg., to add an element to a Set.

  17. def merge(term: R): Unit

    Merge two accumulable objects together

    Merge two accumulable objects together

    Normally, a user will not want to use this version, but will instead call add.

    term

    the other R that will get merged with this

  18. val name: Option[String]

    human-readable name for use in Spark's web UI

  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. def setValue(newValue: R): Unit

    Set the accumulator's value; only allowed on master

  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  24. def toString(): String

    Definition Classes
    Accumulable → AnyRef → Any
  25. def value: R

    Access the accumulator's current value; only allowed on master.

  26. def value_=(newValue: R): Unit

    Set the accumulator's value; only allowed on master.

  27. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. val zero: R

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped