Create the partition path if it does not exist when listing data files in a partition
This commit is contained in:
committed by
vinoth chandar
parent
e3b273e9fd
commit
77e54e78f8
@@ -117,6 +117,8 @@ public class HoodieTableFileSystemView implements TableFileSystemView, Serializa
|
||||
protected FileStatus[] listDataFilesInPartition(String partitionPathStr) {
|
||||
Path partitionPath = new Path(metaClient.getBasePath(), partitionPathStr);
|
||||
try {
|
||||
// Create the path if it does not exist already
|
||||
FSUtils.createPathIfNotExists(fs, partitionPath);
|
||||
return fs.listStatus(partitionPath, path -> path.getName()
|
||||
.contains(metaClient.getTableConfig().getROFileFormat().getFileExtension()));
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -349,4 +349,10 @@ public class FSUtils {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void createPathIfNotExists(FileSystem fs, Path partitionPath) throws IOException {
|
||||
if(!fs.exists(partitionPath)) {
|
||||
fs.mkdirs(partitionPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user