Skip to content

Commit bd9cf56

Browse files
committed
[HUDI-2743] Assume path exists and defer fs.exists() in AbstractTableFileSystemView
Add a unit test Assume partition exists and create only when not found
1 parent 8281cbf commit bd9cf56

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,16 @@ private void ensurePartitionLoadedCorrectly(String partition) {
315315
* @throws IOException
316316
*/
317317
protected FileStatus[] listPartition(Path partitionPath) throws IOException {
318-
// Create the path if it does not exist already
319-
if (!metaClient.getFs().exists(partitionPath)) {
320-
metaClient.getFs().mkdirs(partitionPath);
321-
return new FileStatus[0];
322-
} else {
318+
try {
323319
return metaClient.getFs().listStatus(partitionPath);
320+
} catch (IOException e) {
321+
// Create the path if it does not exist already
322+
if (!metaClient.getFs().exists(partitionPath)) {
323+
metaClient.getFs().mkdirs(partitionPath);
324+
return new FileStatus[0];
325+
}
324326
}
327+
throw new HoodieIOException(String.format("Failed to list partition path: %s", partitionPath));
325328
}
326329

327330
/**

0 commit comments

Comments
 (0)