[HUDI-2743] Assume path exists and defer fs.exists() in AbstractTableFileSystemView (#4002)
This commit is contained in:
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user