Skip to content

Commit

Permalink
[SPARK-23928][TESTS][FOLLOWUP] Set seed to avoid flakiness
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

The tests for shuffle can be flaky (eg. https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/94355/testReport/). This happens because we have not set the seed for `Random`.

## How was this patch tested?

running 10000 times the UT (validated that with a different seed eg. 12345 the test fails).

Closes #22023 from mgaido91/SPARK-23928_followup.

Authored-by: Marco Gaido <marcogaido91@gmail.com>
Signed-off-by: hyukjinkwon <gurwls223@apache.org>
  • Loading branch information
mgaido91 authored and HyukjinKwon committed Aug 7, 2018
1 parent b4bf8be commit 6a143e3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ class CollectionExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper
checkEvaluation(Shuffle(as7, Some(0)), null)
checkEvaluation(Shuffle(aa, Some(0)), Seq(Seq("e"), Seq("a", "b"), Seq("c", "d")))

val r = new Random()
val r = new Random(1234)
val seed1 = Some(r.nextLong())
assert(evaluateWithoutCodegen(Shuffle(ai0, seed1)) ===
evaluateWithoutCodegen(Shuffle(ai0, seed1)))
Expand Down

0 comments on commit 6a143e3

Please sign in to comment.