alexeykudinkin commented on a change in pull request #4739:
URL: https://github.com/apache/hudi/pull/4739#discussion_r802061346
##########
File path:
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieMetadataPayload.java
##########
@@ -219,10 +220,22 @@ protected HoodieMetadataPayload(String key, int type,
Option<Map<String, Long>> filesAdded,
Option<List<String>> filesDeleted) {
Map<String, HoodieMetadataFileInfo> fileInfo = new HashMap<>();
- filesAdded.ifPresent(
- m -> m.forEach((filename, size) -> fileInfo.put(filename, new
HoodieMetadataFileInfo(size, false))));
- filesDeleted.ifPresent(
- m -> m.forEach(filename -> fileInfo.put(filename, new
HoodieMetadataFileInfo(0L, true))));
+ filesAdded.ifPresent(filesMap ->
+ fileInfo.putAll(
+ filesMap.entrySet().stream().collect(
+ Collectors.toMap(Map.Entry::getKey, (entry) -> {
+ long fileSize = entry.getValue();
+ // Assert that the file-size of the file being added is
positive, since Hudi
+ // should not be creating empty files
+ checkState(fileSize > 0);
+ return new HoodieMetadataFileInfo(fileSize, false);
+ })))
+ );
+ filesDeleted.ifPresent(filesList ->
+ fileInfo.putAll(
Review comment:
Agreed. Please check my previous comment regarding GC impact.
Primary reason for this change to streamline the merge as much as possible,
given that this code will be sitting in the hot-path
--
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]