Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12862#discussion_r61848671
  
    --- Diff: 
core/src/test/scala/org/apache/spark/util/AccumulatorV2Suite.scala ---
    @@ -86,4 +86,48 @@ class AccumulatorV2Suite extends SparkFunSuite {
         assert(acc.sum == 5.0)
         assert(acc.avg == 1.25)
       }
    +
    +  test("ListAccumulator") {
    +    val maxI = 1000
    +    for (nThreads <- List(1, 10)) {
    +      // test single & multi-threaded
    +      sc = new SparkContext("local[" + nThreads + "]", "test")
    +      val acc = sc.listAccumulator[Double]
    +      assert(acc.isZero)
    +
    +      val d = sc.parallelize((1 to maxI) ++ (1 to maxI)).map(_.toDouble)
    +      d.foreach { x => acc.add(x) }
    +
    +      assert(acc.value.size() === 2*maxI)
    +      for (i <- 1 to maxI) {
    +        assert(acc.value.contains(i.toDouble))
    +      }
    +      resetSparkContext()
    +    }
    +  }
    +
    +  test("LegacyAccumulatorWrapper") {
    +    val acc = new LegacyAccumulatorWrapper("default", 
AccumulatorParam.StringAccumulatorParam)
    +    assert(acc.value === "default")
    +    assert(!acc.isZero)
    +
    +    acc.add("foo")
    +    assert(acc.value === "foo")
    +    assert(!acc.isZero)
    +
    +    // test using non-specialized add function
    --- End diff --
    
    string is not primitive so i don't think there is a difference between 
specialized / non-specialized. you can just remove this


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to