JoshRosen commented on a change in pull request #24672: [SPARK-27801] InMemoryFileIndex.listLeafFiles should use listLocatedStatus for DistributedFileSystem URL: https://github.com/apache/spark/pull/24672#discussion_r286322473
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/InMemoryFileIndex.scala ########## @@ -274,7 +275,21 @@ object InMemoryFileIndex extends Logging { // [SPARK-17599] Prevent InMemoryFileIndex from failing if path doesn't exist // Note that statuses only include FileStatus for the files and dirs directly under path, // and does not include anything else recursively. - val statuses = try fs.listStatus(path) catch { + val statuses: Array[FileStatus] = try { + fs match { + // DistributedFileSystem overrides listLocatedStatus to make 1 single call to namenode + // to retrieve the file status with the file block location. The reason to still fallback + // to listStatus is because the default implementation would potentially throw a + // FileNotFoundException which is better handled by doing the lookups manually below. Review comment: FYI, over at https://github.com/apache/spark/pull/24668 I'm proposing a change to the `FileNotFoundException` handling logic here: after my patch's changes, we'll only ignore `FileNotFoundException` if we are not listing the root directory of the table (i.e. we are listing a subfolder) _and_ the `ignoreMissingFiles` setting has not been set. Does that change have any implications for this PR? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org