Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/18078#discussion_r118639880 --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala --- @@ -825,6 +837,43 @@ object SparkSubmit extends CommandLineUtils { .mkString(",") if (merged == "") null else merged } + + /** + * Download a list of remote files to temp local files. If the file is local, the original file + * will be returned. + * @param fileList A comma separated file list, it cannot be null. + * @return A comma separated local files list. + */ + private[deploy] def downloadFileList( + fileList: String, + hadoopConf: HadoopConfiguration): String = { + fileList.split(",").map(downloadFile(_, hadoopConf)).mkString(",") + } + + /** + * Download remote file to a temporary local file. If the file is local, the original file + * will be returned. + */ + private[deploy] def downloadFile(path: String, hadoopConf: HadoopConfiguration): String = { + val uri = Utils.resolveURI(path) + uri.getScheme match { + case "file" | "local" => + path + + case _ => + val fs = FileSystem.get(uri, hadoopConf) + val tmpFile = new File(Files.createTempDirectory("tmp").toFile, uri.getPath) + // scalastyle:off println + printStream.println(s"Downloading ${uri.toString} to ${tmpFile.getAbsolutePath}.") + // scalastyle:on println + fs.copyToLocalFile(new Path(uri), new Path(tmpFile.getAbsolutePath)) + UriBuilder + .fromPath(tmpFile.getAbsolutePath) + .scheme("file") + .build() + .toString --- End diff -- It sounds like our code base never calls `UriBuilder` directly.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org