Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3670#discussion_r23723648
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -555,17 +584,42 @@ private[spark] object Utils extends Logging {
             uc.setReadTimeout(timeout)
             uc.connect()
             val in = uc.getInputStream()
    -        downloadFile(url, in, tempFile, targetFile, fileOverwrite)
    +        downloadFile(url, in, targetFile, fileOverwrite)
           case "file" =>
             // In the case of a local file, copy the local file to the target 
directory.
             // Note the difference between uri vs url.
             val sourceFile = if (uri.isAbsolute) new File(uri) else new 
File(url)
             copyFile(url, sourceFile, targetFile, fileOverwrite)
           case _ =>
    -        // Use the Hadoop filesystem library, which supports file://, 
hdfs://, s3://, and others
             val fs = getHadoopFileSystem(uri, hadoopConf)
    -        val in = fs.open(new Path(uri))
    -        downloadFile(url, in, tempFile, targetFile, fileOverwrite)
    +        val path = new Path(uri)
    +        fetchHcfsFile(path, new File(targetDir, path.getName), fs, conf, 
securityMgr, hadoopConf,
    +          fileOverwrite)
    +    }
    +  }
    +
    +  /**
    +   * Fetch a file or directory from a Hadoop-compatible filesystem.
    +   */
    +  private def fetchHcfsFile(
    +      path: Path,
    +      targetDir: File,
    +      fs: FileSystem,
    +      conf: SparkConf,
    +      securityMgr: SecurityManager,
    --- End diff --
    
    `securityMgr` isn't really used in this method?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to