File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1717
1818package org .apache .spark .sql .execution .datasources
1919
20+ import java .io .FileNotFoundException
21+
2022import scala .collection .mutable
2123
2224import org .apache .hadoop .conf .Configuration
@@ -137,7 +139,15 @@ object ListingFileCatalog extends Logging {
137139 paths.flatMap { path =>
138140 logTrace(s " Listing $path" )
139141 val fs = path.getFileSystem(hadoopConf)
140- listLeafFiles0(fs, fs.getFileStatus(path), filter)
142+
143+ // [SPARK-17599] Prevent ListingFileCatalog from failing if path doesn't exist
144+ val status : Option [FileStatus ] = try Option (fs.getFileStatus(path)) catch {
145+ case _ : FileNotFoundException =>
146+ logWarning(s " The directory $path was not found. Was it deleted very recently? " )
147+ None
148+ }
149+
150+ status.map(listLeafFiles0(fs, _, filter)).getOrElse(Seq .empty)
141151 }
142152 }
143153
You can’t perform that action at this time.
0 commit comments