alexeykudinkin commented on a change in pull request #4739:
URL: https://github.com/apache/hudi/pull/4739#discussion_r798116440
##########
File path:
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieMetadataPayload.java
##########
@@ -215,19 +215,16 @@ public HoodieMetadataPayload
preCombine(HoodieMetadataPayload previousRecord) {
if (filesystemMetadata != null) {
filesystemMetadata.forEach((filename, fileInfo) -> {
- // If the filename wasnt present then we carry it forward
- if (!combinedFileInfo.containsKey(filename)) {
- combinedFileInfo.put(filename, fileInfo);
+ if (fileInfo.getIsDeleted()) {
+ combinedFileInfo.remove(filename);
} else {
- if (fileInfo.getIsDeleted()) {
- // file deletion
- combinedFileInfo.remove(filename);
- } else {
- // file appends.
- combinedFileInfo.merge(filename, fileInfo, (oldFileInfo,
newFileInfo) -> {
- return new HoodieMetadataFileInfo(oldFileInfo.getSize() +
newFileInfo.getSize(), false);
- });
- }
+ // NOTE: There are 2 possible cases here:
+ // - New file is created: in that case we're simply adding its
info
+ // - File is appended to (only log-files of MOR tables on
supported FS): in that case
+ // we simply pick the info w/ largest file-size as the most
recent one, since file's
+ // sizes are increasing monotonically (meaning that the larger
file-size is more recent one)
+ combinedFileInfo.merge(filename, fileInfo, (oldFileInfo,
newFileInfo) ->
Review comment:
Correct
--
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]