HyukjinKwon commented on a change in pull request #32394:
URL: https://github.com/apache/spark/pull/32394#discussion_r624881857



##########
File path: core/src/test/scala/org/apache/spark/benchmark/BenchmarkBase.scala
##########
@@ -49,7 +49,11 @@ abstract class BenchmarkBase {
       val resultFileName =
         s"${this.getClass.getSimpleName.replace("$", 
"")}$jdkString$suffix-results.txt"
       val prefix = Benchmarks.currentProjectRoot.map(_ + "/").getOrElse("")
-      val file = new File(s"${prefix}benchmarks/$resultFileName")
+      val dir = new File(s"${prefix}benchmarks/")
+      if (!dir.exists()) {
+        dir.mkdirs()
+      }
+      val file = new File(s"${dir}$resultFileName")

Review comment:
       @byungsoo-oh can you add an assert here with a pretty error message 
saying the `benchmarks` directory has to be manually created? My concern is 
that it happened to create `benchmarks` directly in a weird location mistakenly 
(because the directories are based on the jar location which is pretty flaky 
and hacky)

##########
File path: core/src/test/scala/org/apache/spark/benchmark/BenchmarkBase.scala
##########
@@ -49,7 +49,11 @@ abstract class BenchmarkBase {
       val resultFileName =
         s"${this.getClass.getSimpleName.replace("$", 
"")}$jdkString$suffix-results.txt"
       val prefix = Benchmarks.currentProjectRoot.map(_ + "/").getOrElse("")
-      val file = new File(s"${prefix}benchmarks/$resultFileName")
+      val dir = new File(s"${prefix}benchmarks/")
+      if (!dir.exists()) {
+        dir.mkdirs()
+      }
+      val file = new File(s"${dir}$resultFileName")

Review comment:
       @byungsoo-oh can you instead add an assert here with a pretty error 
message saying the `benchmarks` directory has to be manually created? My 
concern is that it happened to create `benchmarks` directly in a weird location 
mistakenly (because the directories are based on the jar location which is 
pretty flaky and hacky)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to