1
0

[HUDI-2743] Assume path exists and defer fs.exists() in AbstractTableFileSystemView (#4002)

This commit is contained in:
Sagar Sumit
2021-11-23 08:43:10 +05:30
committed by GitHub
parent 6aa710eae0
commit c88c2af8bf

View File

@@ -315,13 +315,16 @@ public abstract class AbstractTableFileSystemView implements SyncableFileSystemV
* @throws IOException * @throws IOException
*/ */
protected FileStatus[] listPartition(Path partitionPath) throws IOException { protected FileStatus[] listPartition(Path partitionPath) throws IOException {
// Create the path if it does not exist already try {
if (!metaClient.getFs().exists(partitionPath)) {
metaClient.getFs().mkdirs(partitionPath);
return new FileStatus[0];
} else {
return metaClient.getFs().listStatus(partitionPath); return metaClient.getFs().listStatus(partitionPath);
} catch (IOException e) {
// Create the path if it does not exist already
if (!metaClient.getFs().exists(partitionPath)) {
metaClient.getFs().mkdirs(partitionPath);
return new FileStatus[0];
}
} }
throw new HoodieIOException(String.format("Failed to list partition path: %s", partitionPath));
} }
/** /**