Skip to content

Commit 5c6a640

Browse files
committed
Fix tests
1 parent 2a76ec1 commit 5c6a640

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/ListingFileCatalog.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.apache.spark.sql.execution.datasources
1919

20+
import java.io.FileNotFoundException
21+
2022
import scala.collection.mutable
2123

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

0 commit comments

Comments
 (0)