Look again, the type is AccumulatorParam, not AccumulableParam. But
yes that's what you do.

On Thu, Nov 13, 2014 at 4:32 AM, Steve Lewis <lordjoe2...@gmail.com> wrote:
> I see Javadoc Style documentation but nothing that looks like a code sample
> I tried the following before asking
>
>     public static class LongAccumulableParam implements
> AccumulableParam<Long,Long>,Serializable {
>          @Override
>         public Long addAccumulator(final Long r, final Long t) {
>             return r + t;
>         }
>          @Override
>         public Long addInPlace(final Long r1, final Long r2) {
>             return  r1 + r2;
>         }
>          @Override
>         public Long zero(final Long initialValue) {
>             return 0L;
>         }
>     }
>
>    sparkContext.currentContext.accumulator(0L, "myAccumulator, new
> LongAccumulableParam ());
>
>  does not compile which is why I ask for code samples
>
> The Javados for accumulator says
> accumulator(T initialValue, AccumulatorParam<T> accumulatorParam)
> Create an Accumulator variable of a given type, which tasks can "add" values
> to using the add method.
> which is a LONG way from a working code sample

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org

Reply via email to