Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/8314#discussion_r43774397
--- 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 --
makes sense, I'll update those ranges.
Ideally, yes I'd do the same to DataFrameStatSuite -- however the
`checkAnswer` function expects an exact match, and adds some extra info about
the query plan etc. I can update that to take a more general comparison
function, but seems like overkill?
---
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]