Repository: spark
Updated Branches:
  refs/heads/master c0b7df68f -> e2f38167f


[SPARK-9376] [SQL] use a seed in RandomDataGeneratorSuite

Make this test deterministic, i.e. make sure this test can be passed no matter 
how many times we run it.

The origin implementation uses a random seed and gives a chance that we may 
break the null check assertion 
`assert(Iterator.fill(100)(generator()).contains(null))`.

Author: Wenchen Fan <[email protected]>

Closes #7691 from cloud-fan/seed and squashes the following commits:

eae7281 [Wenchen Fan] use a seed in RandomDataGeneratorSuite


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e2f38167
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e2f38167
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e2f38167

Branch: refs/heads/master
Commit: e2f38167f8b5678ac45794eacb9c7bb9b951af82
Parents: c0b7df6
Author: Wenchen Fan <[email protected]>
Authored: Mon Jul 27 11:02:16 2015 -0700
Committer: Josh Rosen <[email protected]>
Committed: Mon Jul 27 11:02:16 2015 -0700

----------------------------------------------------------------------
 .../test/scala/org/apache/spark/sql/RandomDataGeneratorSuite.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/e2f38167/sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGeneratorSuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGeneratorSuite.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGeneratorSuite.scala
index 677ba0a..cccac7e 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGeneratorSuite.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGeneratorSuite.scala
@@ -32,7 +32,7 @@ class RandomDataGeneratorSuite extends SparkFunSuite {
    */
   def testRandomDataGeneration(dataType: DataType, nullable: Boolean = true): 
Unit = {
     val toCatalyst = CatalystTypeConverters.createToCatalystConverter(dataType)
-    val generator = RandomDataGenerator.forType(dataType, nullable).getOrElse {
+    val generator = RandomDataGenerator.forType(dataType, nullable, 
Some(33)).getOrElse {
       fail(s"Random data generator was not defined for $dataType")
     }
     if (nullable) {


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

Reply via email to