1
0

[HUDI-2089]fix the bug that metatable cannot support non_partition table (#3182)

This commit is contained in:
xiarixiaoyao
2021-07-06 11:14:05 +08:00
committed by GitHub
parent 0bd20827ab
commit a0f598d371
2 changed files with 50 additions and 3 deletions

View File

@@ -318,7 +318,7 @@ public abstract class HoodieBackedTableMetadataWriter implements HoodieTableMeta
createInstantTime);
}).forEach(status -> {
HoodieWriteStat writeStat = new HoodieWriteStat();
writeStat.setPath(partition + Path.SEPARATOR + status.getPath().getName());
writeStat.setPath((partition.isEmpty() ? "" : partition + Path.SEPARATOR) + status.getPath().getName());
writeStat.setPartitionPath(partition);
writeStat.setTotalWriteBytes(status.getLen());
commitMetadata.addWriteStat(partition, writeStat);
@@ -374,9 +374,10 @@ public abstract class HoodieBackedTableMetadataWriter implements HoodieTableMeta
.collect(Collectors.toList());
if (p.getRight().length > filesInDir.size()) {
// Is a partition. Add all data files to result.
String partitionName = FSUtils.getRelativePartitionPath(new Path(datasetMetaClient.getBasePath()), p.getLeft());
partitionToFileStatus.put(partitionName, filesInDir);
// deal with Non-partition table, we should exclude .hoodie
partitionToFileStatus.put(partitionName, filesInDir.stream()
.filter(f -> !f.getPath().getName().equals(HoodieTableMetaClient.METAFOLDER_NAME)).collect(Collectors.toList()));
} else {
// Add sub-dirs to the queue
pathsToList.addAll(Arrays.stream(p.getRight())