diff options
author | Kan Zhang <kzhang@apache.org> | 2014-06-14 14:31:28 -0700 |
---|---|---|
committer | Matei Zaharia <matei@databricks.com> | 2014-06-14 14:31:28 -0700 |
commit | 7dd9fc67a63985493ad0482d307edd56f3af0b9d (patch) | |
tree | 5d266c0558252a193411773a7dc80d38ed92578c /core/src/test | |
parent | b52603b039cdfa0f8e58ef3c6229d79e732ffc58 (diff) | |
download | spark-7dd9fc67a63985493ad0482d307edd56f3af0b9d.tar.gz spark-7dd9fc67a63985493ad0482d307edd56f3af0b9d.tar.bz2 spark-7dd9fc67a63985493ad0482d307edd56f3af0b9d.zip |
[SPARK-1837] NumericRange should be partitioned in the same way as other...
... sequences
Author: Kan Zhang <kzhang@apache.org>
Closes #776 from kanzhang/SPARK-1837 and squashes the following commits:
e48f018 [Kan Zhang] [SPARK-1837] code refactoring
67c33b5 [Kan Zhang] minor change
403f9b1 [Kan Zhang] [SPARK-1837] NumericRange should be partitioned in the same way as other sequences
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/scala/org/apache/spark/rdd/ParallelCollectionSplitSuite.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/src/test/scala/org/apache/spark/rdd/ParallelCollectionSplitSuite.scala b/core/src/test/scala/org/apache/spark/rdd/ParallelCollectionSplitSuite.scala index 4df36558b6..1b112f1a41 100644 --- a/core/src/test/scala/org/apache/spark/rdd/ParallelCollectionSplitSuite.scala +++ b/core/src/test/scala/org/apache/spark/rdd/ParallelCollectionSplitSuite.scala @@ -111,6 +111,24 @@ class ParallelCollectionSplitSuite extends FunSuite with Checkers { assert(slices.forall(_.isInstanceOf[Range])) } + test("identical slice sizes between Range and NumericRange") { + val r = ParallelCollectionRDD.slice(1 to 7, 4) + val nr = ParallelCollectionRDD.slice(1L to 7L, 4) + assert(r.size === 4) + for (i <- 0 until r.size) { + assert(r(i).size === nr(i).size) + } + } + + test("identical slice sizes between List and NumericRange") { + val r = ParallelCollectionRDD.slice(List(1, 2), 4) + val nr = ParallelCollectionRDD.slice(1L to 2L, 4) + assert(r.size === 4) + for (i <- 0 until r.size) { + assert(r(i).size === nr(i).size) + } + } + test("large ranges don't overflow") { val N = 100 * 1000 * 1000 val data = 0 until N |