Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/8314#discussion_r43775037
--- 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 --
If it's more complicated than just checking for the same range you do here,
leave it. If it's really the same thing and just a matter of adding a range
check, probably worth it.
---
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]