diff options
author | Imran Rashid <imran@quantifind.com> | 2012-08-20 15:17:31 -0700 |
---|---|---|
committer | Imran Rashid <imran@quantifind.com> | 2012-10-04 23:05:42 -0700 |
commit | e0698f8f2609642c91ca059141ba260bbb46d50b (patch) | |
tree | b2562a61b81b3df03bd62ca826703a0deb405f6e /core/src/test/scala | |
parent | 82a3327862d678500ecebd004c1b5b04862aaad8 (diff) | |
download | spark-e0698f8f2609642c91ca059141ba260bbb46d50b.tar.gz spark-e0698f8f2609642c91ca059141ba260bbb46d50b.tar.bz2 spark-e0698f8f2609642c91ca059141ba260bbb46d50b.zip |
change tests to show utility of localValue
Diffstat (limited to 'core/src/test/scala')
-rw-r--r-- | core/src/test/scala/spark/AccumulatorSuite.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/src/test/scala/spark/AccumulatorSuite.scala b/core/src/test/scala/spark/AccumulatorSuite.scala index ee14820c6a..b920e53534 100644 --- a/core/src/test/scala/spark/AccumulatorSuite.scala +++ b/core/src/test/scala/spark/AccumulatorSuite.scala @@ -119,11 +119,12 @@ class AccumulatorSuite extends FunSuite with ShouldMatchers with BeforeAndAfter for (nThreads <- List(1, 10)) { //test single & multi-threaded val sc = new SparkContext("local[" + nThreads + "]", "test") val acc: Accumulable[mutable.Set[Any], Any] = sc.accumulable(new mutable.HashSet[Any]()) - val d = sc.parallelize(1 to maxI) + val groupedInts = (1 to (maxI/20)).map {x => (20 * (x - 1) to 20 * x).toSet} + val d = sc.parallelize(groupedInts) d.foreach { - x => acc.localValue += x + x => acc.localValue ++= x } - acc.value should be ( (1 to maxI).toSet) + acc.value should be ( (0 to maxI).toSet) } } |