wzx140 commented on code in PR #6745:
URL: https://github.com/apache/hudi/pull/6745#discussion_r979270175


##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieMergedLogRecordScanner.java:
##########
@@ -152,8 +156,7 @@ protected <T> void processNextRecord(HoodieRecord<T> 
hoodieRecord) throws IOExce
       T combinedValue = ((HoodieRecord<T>) recordMerger.merge(oldRecord, 
hoodieRecord, readerSchema, 
this.hoodieTableMetaClient.getTableConfig().getProps()).get()).getData();
       // If combinedValue is oldValue, no need rePut oldRecord
       if (combinedValue != oldValue) {
-        hoodieRecord.setData(combinedValue);
-        records.put(key, hoodieRecord);
+        records.put(key, hoodieRecord.newInstance(combinedValue));

Review Comment:
   We can see the old logic. It make a new record that use combinedValue and 
other parts from hoodieRecord.
   ```java
         HoodieRecord<? extends HoodieRecordPayload> oldRecord = 
records.get(key);
         HoodieRecordPayload oldValue = oldRecord.getData();
         HoodieRecordPayload combinedValue = 
hoodieRecord.getData().preCombine(oldValue);
         // If combinedValue is oldValue, no need rePut oldRecord
         if (combinedValue != oldValue) {
           HoodieOperation operation = hoodieRecord.getOperation();
           records.put(key, new HoodieAvroRecord<>(new HoodieKey(key, 
hoodieRecord.getPartitionPath()), combinedValue, operation));
         }
   ```



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