catalinii commented on a change in pull request #32679:
URL: https://github.com/apache/spark/pull/32679#discussion_r693130413
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/InMemoryFileIndex.scala
##########
@@ -94,10 +97,23 @@ class InMemoryFileIndex(
val files = listLeafFiles(rootPaths)
cachedLeafFiles =
new mutable.LinkedHashMap[Path, FileStatus]() ++= files.map(f =>
f.getPath -> f)
- cachedLeafDirToChildrenFiles = files.toArray.groupBy(_.getPath.getParent)
+ cachedLeafDirToChildrenFiles =
+ if (readPartitionWithSubdirectoryEnabled) {
+ files.toArray.groupBy(file =>
getRootPathsLeafDir(file.getPath.getParent))
+ } else {
+ files.toArray.groupBy(_.getPath.getParent)
+ }
cachedPartitionSpec = null
}
+ private def getRootPathsLeafDir(path: Path): Path = {
+ if (rootPaths.contains(path)) {
+ path
+ } else {
+ getRootPathsLeafDir(path.getParent)
Review comment:
This fails with NPE if a parquet file is provided directly (instead of a
directory).
The fix:
https://github.com/lyft/spark/commit/4375b8a13bf15dc6c8b09f094ef1b6eefe84b043
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]