I think that's right, but that seems as expected. If you're going to
use this utility wrapper class, it can only determine if something is
zero by comparing it to your 'zero' object, and that means defining
equality. I suspect it's uncommon to accumulate things that aren't
primitives or standard collections, which already define equality. But
I'd expect I'd have to define equality for some custom user class in
general if handing it over for a library to compare, add, clear, etc.

On Mon, Jun 13, 2016 at 8:15 PM, Amit Sela <amitsel...@gmail.com> wrote:
> It seems that if you have an AccumulatorParam (or AccumulableParam) where
> "R" is not a primitive, it will need to implement equlas() if the
> implementation of the zero() creates a new instance (which I guess it will
> in those cases).
> This is where isZero applies the comparison:
> https://github.com/apache/spark/blob/254bc8c34e70241508bdfc8ff42a65491f5280cd/core/src/main/scala/org/apache/spark/util/AccumulatorV2.scala#L462
> I overcame this by providing null in zero and instantiating in
> addAccumulator() but that's more of a hack, on the other hand, I don't see a
> trivial solution, which is one of the reasons I'm writing this.
> Anyone encounter this when upgrading to 2.0 ?  with non-trivial Accumulators
> of course..
>
>
> Thanks,
> Amit

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

Reply via email to