Github user smartnut007 commented on a diff in the pull request:
https://github.com/apache/spark/pull/477#discussion_r11839813
--- Diff: core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala ---
@@ -465,7 +465,13 @@ class RDDSuite extends FunSuite with
SharedSparkContext {
test("takeSample") {
val data = sc.parallelize(1 to 100, 2)
-
+
+ for (num <- List(5,20,100)) {
+ val sample = data.takeSample(withReplacement=false, num=num)
+ assert(sample.size === num) // Got exactly num elements
+ assert(sample.toSet.size === num) // Elements are distinct
+ assert(sample.forall(x => 1 <= x && x <= 100), "elements not in [1,
100]")
+ }
--- End diff --
will take care of the indent
---
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.
---