xushiyan commented on a change in pull request #4489:
URL: https://github.com/apache/hudi/pull/4489#discussion_r778551692
##########
File path:
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
##########
@@ -109,15 +111,31 @@ public static void deleteMetadataTable(String basePath,
HoodieEngineContext cont
: hoodieWriteStat.getTotalWriteBytes();
newFiles.put(filename, totalWriteBytes);
});
+
// New files added to a partition
- HoodieRecord record = HoodieMetadataPayload.createPartitionFilesRecord(
- partition, Option.of(newFiles), Option.empty());
- records.add(record);
+ if (!newFiles.isEmpty()) {
+ HoodieRecord record = HoodieMetadataPayload.createPartitionFilesRecord(
+ partition, Option.of(newFiles), Option.empty());
+ records.add(record);
+ }
});
- // New partitions created
- HoodieRecord record = HoodieMetadataPayload.createPartitionListRecord(new
ArrayList<>(allPartitions));
- records.add(record);
+ // Add delete partition's record
+ if (commitMetadata instanceof HoodieReplaceCommitMetadata
+ &&
WriteOperationType.DELETE_PARTITION.equals(commitMetadata.getOperationType())) {
Review comment:
would it be better to extract these logic to a common util method to
make it explicit about this check? say `isDeletePartition()`. Recall somewhere
else also checking this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]