Skip to content

Commit c3d759f

Browse files
HyukjinKwondongjoon-hyun
authored andcommitted
[SPARK-26496][SS][TEST] Avoid to use Random.nextString in StreamingInnerJoinSuite
## What changes were proposed in this pull request? Similar with #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 #23405 from HyukjinKwon/SPARK-26496. Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit e63243d) Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent acbfb31 commit c3d759f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingJoinSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ class StreamingInnerJoinSuite extends StreamTest with StateStoreMetricsTest with
352352
withTempDir { tempDir =>
353353
val queryId = UUID.randomUUID
354354
val opId = 0
355-
val path = Utils.createDirectory(tempDir.getAbsolutePath, Random.nextString(10)).toString
355+
val path = Utils.createDirectory(tempDir.getAbsolutePath, Random.nextFloat.toString).toString
356356
val stateInfo = StatefulOperatorStateInfo(path, queryId, opId, 0L, 5)
357357

358358
implicit val sqlContext = spark.sqlContext

0 commit comments

Comments
 (0)