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

    https://github.com/apache/spark/pull/8314#discussion_r43612066
  
    --- Diff: 
sql/core/src/test/java/test/org/apache/spark/sql/JavaDataFrameSuite.java ---
    @@ -258,7 +258,9 @@ public void testSampleBy() {
         DataFrame df = context.range(0, 100, 1, 
2).select(col("id").mod(3).as("key"));
         DataFrame sampled = df.stat().<Integer>sampleBy("key", 
ImmutableMap.of(0, 0.1, 1, 0.2), 0L);
         Row[] actual = sampled.groupBy("key").count().orderBy("key").collect();
    -    Row[] expected = {RowFactory.create(0, 5), RowFactory.create(1, 8)};
    -    Assert.assertArrayEquals(expected, actual);
    +    Assert.assertEquals(0, actual[0].getLong(0));
    +    Assert.assertTrue(1 <= actual[0].getLong(1) && actual[0].getLong(1) <= 
6);
    +    Assert.assertEquals(1, actual[1].getLong(0));
    +    Assert.assertTrue(4 <= actual[1].getLong(1) && actual[1].getLong(1) <= 
11);
    --- End diff --
    
    Right now the test returns 6 and 11 right?  I'm just estimating good bounds 
using a binomial cdf, but 0-8 and 2-13 are reasonable ranges for both given the 
setup (roughly, less than 0.1% chance something outside that range is OK). Does 
the same need to be applied in `DataFrameStatSuite` below ideally?


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to