1
0

[HUDI-2005] Fixing partition path creation in AbstractTableFileSystemView (#3769)

This commit is contained in:
Sivabalan Narayanan
2021-11-02 00:16:45 -04:00
committed by GitHub
parent 5302b9a4ef
commit 35111131c3
2 changed files with 9 additions and 4 deletions

View File

@@ -285,9 +285,7 @@ public abstract class AbstractTableFileSystemView implements SyncableFileSystemV
try {
LOG.info("Building file system view for partition (" + partitionPathStr + ")");
// Create the path if it does not exist already
Path partitionPath = FSUtils.getPartitionPath(metaClient.getBasePath(), partitionPathStr);
FSUtils.createPathIfNotExists(metaClient.getFs(), partitionPath);
long beginLsTs = System.currentTimeMillis();
FileStatus[] statuses = listPartition(partitionPath);
long endLsTs = System.currentTimeMillis();
@@ -317,7 +315,13 @@ public abstract class AbstractTableFileSystemView implements SyncableFileSystemV
* @throws IOException
*/
protected FileStatus[] listPartition(Path partitionPath) throws IOException {
return metaClient.getFs().listStatus(partitionPath);
// Create the path if it does not exist already
if (!metaClient.getFs().exists(partitionPath)) {
metaClient.getFs().mkdirs(partitionPath);
return new FileStatus[0];
} else {
return metaClient.getFs().listStatus(partitionPath);
}
}
/**