[HUDI-2005] Fixing partition path creation in AbstractTableFileSystemView (#3769)
This commit is contained in:
committed by
GitHub
parent
5302b9a4ef
commit
35111131c3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user