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

    https://github.com/apache/spark/pull/916#discussion_r13210149
  
    --- Diff: core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala ---
    @@ -494,56 +495,84 @@ class RDDSuite extends FunSuite with 
SharedSparkContext {
         assert(sortedTopK === nums.sorted(ord).take(5))
       }
     
    +  test("computeFraction") {
    +    // test that the computed fraction guarantees enough datapoints in the 
sample with a failure rate <= 0.0001
    +    val data = new EmptyRDD[Int](sc)
    +    val n = 100000
    +
    +    for (s <- 1 to 15) {
    +      val frac = data.computeFraction(s, n, true)
    +      val qpois = new PoissonDistribution(frac * n)
    +      assert(qpois.inverseCumulativeProbability(0.0001) >= s, "Computed 
fraction is too low")
    +    }
    +    for (s <- 1 to 15) {
    +      val frac = data.computeFraction(s, n, false)
    +      val qpois = new PoissonDistribution(frac * n)
    --- End diff --
    
    BinomailDistribution should be used instead of Pois.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to