Are you sure you aren't actually trying to extend AccumulableParam instead of AccumulatorParam? The example you cite does the latter. I do not get a compile error from this example.
You also didn't say what version of Spark. (Although there are a few things about the example that could be updated.) On Mon, Oct 13, 2014 at 2:17 PM, WonderfullDay <[email protected]> wrote: > Hello! > I'm new to Spark, and write a Java program with it. > > But when I implement the Accumulator, something > confuse me, here is my implementation: > > /class /WeightAccumulatorParam /implements /AccumulatorParam<Weight>{ > / @*Override*/ > public Weight zero(/Weight /initialValue){ > return new Weight(); > } > / @*Override*/ > public Weight addInPlace(/Weight /v1, /Weight /v2){ > return v1.add(v2); > } > } > > just as the on-line documents says : > <http://apache-spark-user-list.1001560.n3.nabble.com/file/n16278/%E6%8D%95%E8%8E%B71.png> > link to the document > <https://spark.apache.org/docs/latest/programming-guide.html#parallelized-collections> > > But then I met a mistake while building the file: > <http://apache-spark-user-list.1001560.n3.nabble.com/file/n16278/%E6%8D%95%E8%8E%B7.png> > > It told me I need to override the function addAccumulator, too. But the > document doesn't say about this. So I am wonder whether I misunderstanding > the online document or the online document lost something? > > And is it matter if I implement the addAccumulator just as addInPlace > function do? > > > > -- > View this message in context: > http://apache-spark-user-list.1001560.n3.nabble.com/Inconsistency-of-implementing-accumulator-in-Java-tp16278.html > Sent from the Apache Spark User List mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
