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

    https://github.com/apache/spark/pull/13403#discussion_r67924857
  
    --- Diff: core/src/test/java/org/apache/spark/JavaAPISuite.java ---
    @@ -733,8 +733,10 @@ public Boolean call(Double x) {
         assertEquals(20/6.0, rdd.mean(), 0.01);
         assertEquals(20/6.0, rdd.mean(), 0.01);
         assertEquals(6.22222, rdd.variance(), 0.01);
    +    assertEquals(rdd.variance(), rdd.popVariance());
         assertEquals(7.46667, rdd.sampleVariance(), 0.01);
         assertEquals(2.49444, rdd.stdev(), 0.01);
    +    assertEquals(rdd.stdev(), rdd.popStdev(), 0.01);
    --- End diff --
    
    I think it should be approximate equality but with a very small tolerance, 
e.g. 1e-14. Both calls trigger reduce jobs and we don't have guarantees on the 
ordering or reduce operations, which might lead to small numerical errors. 
Maybe it doesn't apply to the test case here, but it is still a best practice 
to not test strict equality of floating-point numbers.


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to