Class SparkMAccumulator<IN,​OUT>

    • Field Detail

      • accumulatorV2

        protected final org.apache.spark.util.AccumulatorV2<IN,​OUT> accumulatorV2
        The AccumulatorV2 being used.
    • Constructor Detail

      • SparkMAccumulator

        public SparkMAccumulator​(org.apache.spark.util.AccumulatorV2<IN,​OUT> accumulatorV2)
        Instantiates a new Spark m accumulator.
        Parameters:
        accumulatorV2 - the accumulator v 2
      • SparkMAccumulator

        public SparkMAccumulator​(LocalMAccumulator<IN,​OUT> localMAccumulator)
        Instantiates a new Spark m accumulator by wrapping a local accumulator.
        Parameters:
        localMAccumulator - the local accumulator to wrap
    • Method Detail

      • add

        public void add​(IN in)
        Description copied from interface: MAccumulator
        Adds an item to the accumulator
        Specified by:
        add in interface MAccumulator<IN,​OUT>
        Parameters:
        in - the item to add
      • merge

        public void merge​(MAccumulator<IN,​OUT> other)
        Description copied from interface: MAccumulator
        Merges another accumulator with this one
        Specified by:
        merge in interface MAccumulator<IN,​OUT>
        Parameters:
        other - the other accumulator to merge
      • reset

        public void reset()
        Description copied from interface: MAccumulator
        Resets the accumulator to its zero-value.
        Specified by:
        reset in interface MAccumulator<IN,​OUT>
      • value

        public OUT value()
        Description copied from interface: MAccumulator
        The value of the accumulator.
        Specified by:
        value in interface MAccumulator<IN,​OUT>
        Returns:
        the result of the accumulator
      • isZero

        public boolean isZero()
        Description copied from interface: MAccumulator
        Determines if the accumulator is a zero value
        Specified by:
        isZero in interface MAccumulator<IN,​OUT>
        Returns:
        True if the accumulator is in a zero state