Skip to content

Commit

Permalink
[SPARK-26496][SS][TEST] Avoid to use Random.nextString in StreamingIn…
Browse files Browse the repository at this point in the history
…nerJoinSuite

## What changes were proposed in this pull request?

Similar with apache#21446. Looks random string is not quite safe as a directory name.

```scala
scala> val prefix = Random.nextString(10); val dir = new File("/tmp", "del_" + prefix + "-" + UUID.randomUUID.toString); dir.mkdirs()
prefix: String = 窽텘⒘駖ⵚ駢⡞Ρ닋੎
dir: java.io.File = /tmp/del_窽텘⒘駖ⵚ駢⡞Ρ닋੎-a3f99855-c429-47a0-a108-47bca6905745
res40: Boolean = false  // nope, didn't like this one
```

## How was this patch tested?

Unit test was added, and manually.

Closes apache#23405 from HyukjinKwon/SPARK-26496.

Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit e63243d)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
  • Loading branch information
HyukjinKwon authored and dongjoon-hyun committed Dec 29, 2018
1 parent 4fb3f6d commit 1802124
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class StreamingInnerJoinSuite extends StreamTest with StateStoreMetricsTest with
withTempDir { tempDir =>
val queryId = UUID.randomUUID
val opId = 0
val path = Utils.createDirectory(tempDir.getAbsolutePath, Random.nextString(10)).toString
val path = Utils.createDirectory(tempDir.getAbsolutePath, Random.nextFloat.toString).toString
val stateInfo = StatefulOperatorStateInfo(path, queryId, opId, 0L, 5)

implicit val sqlContext = spark.sqlContext
Expand Down

0 comments on commit 1802124

Please sign in to comment.