aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorDongjoon Hyun <dongjoon@apache.org>2016-05-24 11:09:54 -0700
committerAndrew Or <andrew@databricks.com>2016-05-24 11:09:54 -0700
commitbe99a99fe7976419d727c0cc92e872aa4af58bf1 (patch)
treebe82948a9c9221c5661d42198fbcd4578117627e /core/src
parent784cc07d1675eb9e0a387673cf86874e1bfc10f9 (diff)
downloadspark-be99a99fe7976419d727c0cc92e872aa4af58bf1.tar.gz
spark-be99a99fe7976419d727c0cc92e872aa4af58bf1.tar.bz2
spark-be99a99fe7976419d727c0cc92e872aa4af58bf1.zip
[MINOR][CORE][TEST] Update obsolete `takeSample` test case.
## What changes were proposed in this pull request? This PR fixes some obsolete comments and assertion in `takeSample` testcase of `RDDSuite.scala`. ## How was this patch tested? This fixes the testcase only. Author: Dongjoon Hyun <dongjoon@apache.org> Closes #13260 from dongjoon-hyun/SPARK-15481.
Diffstat (limited to 'core/src')
-rw-r--r--core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala15
1 files changed, 7 insertions, 8 deletions
diff --git a/core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala b/core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
index 979fb426c9..a4992fe8ac 100644
--- a/core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
+++ b/core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
@@ -678,27 +678,26 @@ class RDDSuite extends SparkFunSuite with SharedSparkContext {
}
{
val sample = data.takeSample(withReplacement = true, num = 20)
- assert(sample.size === 20) // Got exactly 100 elements
- assert(sample.toSet.size <= 20, "sampling with replacement returned all distinct elements")
+ assert(sample.size === 20) // Got exactly 20 elements
assert(sample.forall(x => 1 <= x && x <= n), s"elements not in [1, $n]")
}
{
val sample = data.takeSample(withReplacement = true, num = n)
- assert(sample.size === n) // Got exactly 100 elements
- // Chance of getting all distinct elements is astronomically low, so test we got < 100
+ assert(sample.size === n) // Got exactly n elements
+ // Chance of getting all distinct elements is astronomically low, so test we got < n
assert(sample.toSet.size < n, "sampling with replacement returned all distinct elements")
assert(sample.forall(x => 1 <= x && x <= n), s"elements not in [1, $n]")
}
for (seed <- 1 to 5) {
val sample = data.takeSample(withReplacement = true, n, seed)
- assert(sample.size === n) // Got exactly 100 elements
- // Chance of getting all distinct elements is astronomically low, so test we got < 100
+ assert(sample.size === n) // Got exactly n elements
+ // Chance of getting all distinct elements is astronomically low, so test we got < n
assert(sample.toSet.size < n, "sampling with replacement returned all distinct elements")
}
for (seed <- 1 to 5) {
val sample = data.takeSample(withReplacement = true, 2 * n, seed)
- assert(sample.size === 2 * n) // Got exactly 200 elements
- // Chance of getting all distinct elements is still quite low, so test we got < 100
+ assert(sample.size === 2 * n) // Got exactly 2 * n elements
+ // Chance of getting all distinct elements is still quite low, so test we got < n
assert(sample.toSet.size < n, "sampling with replacement returned all distinct elements")
}
}