codope commented on code in PR #11077:
URL: https://github.com/apache/hudi/pull/11077#discussion_r1602746221


##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieMergedLogRecordScanner.java:
##########
@@ -222,7 +223,8 @@ public Iterator<HoodieRecord> iterator() {
   }
 
   public Map<String, HoodieRecord> getRecords() {
-    return records;
+    return records.entrySet().stream().collect(

Review Comment:
   That will also work but let me put down my thoughts why I considered to use 
`Serializable` as the key type directly instead of a generic type `K extends 
Serializable`. Firstly, if we use `K extends Serializable`, the creators of 
`HoodieMergedLogRecordScanner` need to specify the correct type that matches 
the key. This would increase the surface area of the changes.
   
   Plus, using `Serializable` as the key type directly is more flexible as it 
allows the `ExternalSpillableMap` to accept any object that implements 
Serializable. This means you can use a wide variety of types as keys without 
needing to specify a particular type parameter when instantiating the map.
   
   One drawback of using `Serializable` directly as the key type is the reduced 
type safety. However, this is only an internal API implementation so it is less 
prone to being misused. 



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