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,14 +315,17 @@ public abstract class AbstractTableFileSystemView implements SyncableFileSystemV
* @throws IOException * @throws IOException
*/ */
protected FileStatus[] listPartition(Path partitionPath) throws IOException { protected FileStatus[] listPartition(Path partitionPath) throws IOException {
try {
return metaClient.getFs().listStatus(partitionPath);
} catch (IOException e) {
// Create the path if it does not exist already // Create the path if it does not exist already
if (!metaClient.getFs().exists(partitionPath)) { if (!metaClient.getFs().exists(partitionPath)) {
metaClient.getFs().mkdirs(partitionPath); metaClient.getFs().mkdirs(partitionPath);
return new FileStatus[0]; return new FileStatus[0];
} else {
return metaClient.getFs().listStatus(partitionPath);
} }
} }
throw new HoodieIOException(String.format("Failed to list partition path: %s", partitionPath));
}
/** /**
* Helper to convert file-status to base-files. * Helper to convert file-status to base-files.