[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 <cloud0fan@outlook.com>

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

eae7281 [Wenchen Fan] use a seed in RandomDataGeneratorSuite
This commit is contained in:
Wenchen Fan 2015-07-27 11:02:16 -07:00 committed by Josh Rosen
parent c0b7df68f8
commit e2f38167f8

View file

@ -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) {