Skip to content
Snippets Groups Projects
Commit cd174882 authored by felixcheung's avatar felixcheung Committed by Shivaram Venkataraman
Browse files

[SPARK-9865][SPARKR] Flaky SparkR test: test_sparkSQL.R: sample on a DataFrame

Make sample test less flaky by setting the seed

Tested with
```
repeat {  if (count(sample(df, FALSE, 0.1)) == 3) { break } }
```

Author: felixcheung <felixcheung_m@hotmail.com>

Closes #9549 from felixcheung/rsample.
parent 404a28f4
No related branches found
No related tags found
No related merge requests found
......@@ -647,11 +647,11 @@ test_that("sample on a DataFrame", {
sampled <- sample(df, FALSE, 1.0)
expect_equal(nrow(collect(sampled)), count(df))
expect_is(sampled, "DataFrame")
sampled2 <- sample(df, FALSE, 0.1)
sampled2 <- sample(df, FALSE, 0.1, 0) # set seed for predictable result
expect_true(count(sampled2) < 3)
# Also test sample_frac
sampled3 <- sample_frac(df, FALSE, 0.1)
sampled3 <- sample_frac(df, FALSE, 0.1, 0) # set seed for predictable result
expect_true(count(sampled3) < 3)
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment