You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2018/12/29 20:13:05 UTC

[spark] branch branch-2.3 updated: [SPARK-26496][SS][TEST] Avoid to use Random.nextString in StreamingInnerJoinSuite

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new c3d759f  [SPARK-26496][SS][TEST] Avoid to use Random.nextString in StreamingInnerJoinSuite
c3d759f is described below

commit c3d759fa05ecaf70ee7f8692b846175e405727af
Author: Hyukjin Kwon <gu...@apache.org>
AuthorDate: Sat Dec 29 12:11:45 2018 -0800

    [SPARK-26496][SS][TEST] Avoid to use Random.nextString in StreamingInnerJoinSuite
    
    ## What changes were proposed in this pull request?
    
    Similar with https://github.com/apache/spark/pull/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 <gu...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
    (cherry picked from commit e63243df8aca9f44255879e931e0c372beef9fc2)
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 .../test/scala/org/apache/spark/sql/streaming/StreamingJoinSuite.scala  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingJoinSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingJoinSuite.scala
index 4af6dc3..657a363 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingJoinSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingJoinSuite.scala
@@ -352,7 +352,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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org