diff --git a/hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java b/hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java index eca3718f18a03..58c71652adc76 100644 --- a/hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java +++ b/hudi-common/src/main/java/org/apache/hudi/common/table/view/AbstractTableFileSystemView.java @@ -315,13 +315,16 @@ private void ensurePartitionLoadedCorrectly(String partition) { * @throws IOException */ protected FileStatus[] listPartition(Path partitionPath) throws IOException { - // Create the path if it does not exist already - if (!metaClient.getFs().exists(partitionPath)) { - metaClient.getFs().mkdirs(partitionPath); - return new FileStatus[0]; - } else { + try { 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)); } /**