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/09/18 03:05:11 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #29796: [SPARK-32930][CORE] Replace deprecated isFile/isDirectory methods

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



##########
File path: core/src/main/scala/org/apache/spark/SparkContext.scala
##########
@@ -1881,7 +1881,7 @@ class SparkContext(config: SparkConf) extends Logging {
           if (!fs.exists(hadoopPath)) {
             throw new FileNotFoundException(s"Jar ${path} not found")
           }
-          if (fs.isDirectory(hadoopPath)) {
+          if (fs.getFileStatus(hadoopPath).isDirectory) {

Review comment:
       @williamhyun, looks `fs.getFileStatus(hadoopPath).isDirectory` isn't exact synonym of `fs.isDirectory`, e.g.)
   
   ```java
     public boolean isDirectory(Path f) throws IOException {
       try {
         return getFileStatus(f).isDirectory();
       } catch (FileNotFoundException e) {
         return false;               // f does not exist
       }
     }
   ```
   
   I think you can create a utility methods under `Utils.scala` to reuse.




----------------------------------------------------------------
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



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