danny0405 commented on code in PR #13699:
URL: https://github.com/apache/hudi/pull/13699#discussion_r2268391105


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/FileGroupReaderBasedMergeHandle.java:
##########
@@ -267,26 +393,141 @@ private static class CDCCallback<T> implements 
BaseFileUpdateCallback<T> {
     }
 
     @Override
-    public void onUpdate(String recordKey, T previousRecord, T mergedRecord) {
+    public void onUpdate(String recordKey, BufferedRecord<T> previousRecord, 
BufferedRecord<T> mergedRecord) {
       cdcLogger.put(recordKey, convertOutput(previousRecord), 
Option.of(convertOutput(mergedRecord)));
-
     }
 
     @Override
-    public void onInsert(String recordKey, T newRecord) {
+    public void onInsert(String recordKey, BufferedRecord<T> newRecord) {
       cdcLogger.put(recordKey, null, Option.of(convertOutput(newRecord)));
-
     }
 
     @Override
-    public void onDelete(String recordKey, T previousRecord) {
+    public void onDelete(String recordKey, BufferedRecord<T> previousRecord, 
HoodieOperation hoodieOperation) {
       cdcLogger.put(recordKey, convertOutput(previousRecord), Option.empty());
-
     }
 
-    private GenericRecord convertOutput(T record) {
-      T convertedRecord = outputConverter.get().map(converter -> record == 
null ? null : converter.apply(record)).orElse(record);
+    private GenericRecord convertOutput(BufferedRecord<T> record) {
+      T convertedRecord = outputConverter.get().map(converter -> record == 
null ? null : converter.apply(record.getRecord())).orElse(record.getRecord());
       return convertedRecord == null ? null : 
readerContext.getRecordContext().convertToAvroRecord(convertedRecord, 
requestedSchema.get());
     }
   }
+
+  private static class RecordLevelIndexCallback<T> implements 
BaseFileUpdateCallback<T> {
+    private final WriteStatus writeStatus;
+    private final HoodieRecordLocation fileRecordLocation;
+    private final String partitionPath;
+
+    public RecordLevelIndexCallback(WriteStatus writeStatus, 
HoodieRecordLocation fileRecordLocation, String partitionPath) {
+      this.writeStatus = writeStatus;
+      this.fileRecordLocation = fileRecordLocation;
+      this.partitionPath = partitionPath;
+    }
+
+    @Override
+    public void onUpdate(String recordKey, BufferedRecord<T> previousRecord, 
BufferedRecord<T> mergedRecord) {
+      writeStatus.addRecordDelegate(HoodieRecordDelegate.create(recordKey, 
partitionPath, fileRecordLocation, fileRecordLocation, 
mergedRecord.getHoodieOperation() == HoodieOperation.UPDATE_BEFORE));

Review Comment:
   The flag is used when all the delegates are collected into the driver and 
been utilized to calcurate the RLI index items for MDT, the delegate with flag 
`ignoreIndexUpdate` as true are just been dropped directly, so there is no need 
to even generate and collect them.



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