prashantwason commented on a change in pull request #4739:
URL: https://github.com/apache/hudi/pull/4739#discussion_r802058555



##########
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(

Review comment:
       minor: stream().collect() is going to double the memory used here as it 
creates a new map first before adding to fileInfo. I feel forEach is better 
suited here.
   
   Not a big issue as these are just filenames.




-- 
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]


Reply via email to