aboutsummaryrefslogtreecommitdiff
path: root/sql/core/src/test/java
diff options
context:
space:
mode:
authorImran Rashid <irashid@cloudera.com>2015-11-06 20:06:24 +0000
committerSean Owen <sowen@cloudera.com>2015-11-06 20:06:24 +0000
commit49f1a820372d1cba41f3f00d07eb5728f2ed6705 (patch)
tree535797cc3662bfd7d8247b2d01f6fd00b2e1b2a9 /sql/core/src/test/java
parent62bb290773c9f9fa53cbe6d4eedc6e153761a763 (diff)
downloadspark-49f1a820372d1cba41f3f00d07eb5728f2ed6705.tar.gz
spark-49f1a820372d1cba41f3f00d07eb5728f2ed6705.tar.bz2
spark-49f1a820372d1cba41f3f00d07eb5728f2ed6705.zip
[SPARK-10116][CORE] XORShiftRandom.hashSeed is random in high bits
https://issues.apache.org/jira/browse/SPARK-10116 This is really trivial, just happened to notice it -- if `XORShiftRandom.hashSeed` is really supposed to have random bits throughout (as the comment implies), it needs to do something for the conversion to `long`. mengxr mkolod Author: Imran Rashid <irashid@cloudera.com> Closes #8314 from squito/SPARK-10116.
Diffstat (limited to 'sql/core/src/test/java')
-rw-r--r--sql/core/src/test/java/test/org/apache/spark/sql/JavaDataFrameSuite.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/core/src/test/java/test/org/apache/spark/sql/JavaDataFrameSuite.java b/sql/core/src/test/java/test/org/apache/spark/sql/JavaDataFrameSuite.java
index 49f516e86d..40bff57a17 100644
--- a/sql/core/src/test/java/test/org/apache/spark/sql/JavaDataFrameSuite.java
+++ b/sql/core/src/test/java/test/org/apache/spark/sql/JavaDataFrameSuite.java
@@ -257,7 +257,9 @@ public class JavaDataFrameSuite {
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(0 <= actual[0].getLong(1) && actual[0].getLong(1) <= 8);
+ Assert.assertEquals(1, actual[1].getLong(0));
+ Assert.assertTrue(2 <= actual[1].getLong(1) && actual[1].getLong(1) <= 13);
}
}