You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/03/20 09:54:03 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #27690: [SPARK-21514][SQL] Added a new option to use non-blobstore storage when writing into blobstore storage

HyukjinKwon commented on a change in pull request #27690: [SPARK-21514][SQL] Added a new option to use non-blobstore storage when writing into blobstore storage
URL: https://github.com/apache/spark/pull/27690#discussion_r395532529
 
 

 ##########
 File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/SaveAsHiveFile.scala
 ##########
 @@ -97,7 +99,43 @@ private[hive] trait SaveAsHiveFile extends DataWritingCommand {
       options = Map.empty)
   }
 
-  protected def getExternalTmpPath(
+  /*
+   * Mostly copied from Context.java#getMRTmpPath of Hive 2.3
+   *
+   */
+  def getMRTmpPath(
+      hadoopConf: Configuration,
+      sessionScratchDir: String,
+      scratchDir: String): Path = {
+
+    // Hive's getMRTmpPath uses nonLocalScratchPath + '-mr-10000',
+    // which is ruled by 'hive.exec.scratchdir' including file system.
+    // This is the same as Spark's #oldVersionExternalTempPath
+    // Only difference between #oldVersionExternalTempPath and Hive 2.3.0's is HIVE-7090
+    // HIVE-7090 added user_name/session_id on top of 'hive.exec.scratchdir'
+    // Here it uses session_path unless it's emtpy, otherwise uses scratchDir
+    val sessionPath = Option(sessionScratchDir).filterNot(_.isEmpty).getOrElse(scratchDir)
+    logDebug(s"session path '${sessionPath.toString}' is used")
+
+    val mrScratchDir = oldVersionExternalTempPath(new Path(sessionPath), hadoopConf, sessionPath)
+    logDebug(s"MR scratch dir '$mrScratchDir/-mr-10000' is used")
+    new Path(mrScratchDir, "-mr-10000")
+  }
+
+  private def isBlobStoragePath(path: Path): Boolean = {
+    path != null && isBlobStorageScheme(Option(path.toUri.getScheme).getOrElse(""))
 
 Review comment:
   I wonder how Hive handles default scheme. Does it work when `fs.default.name` is set to `s3` too?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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