the-other-tim-brown commented on code in PR #13444:
URL: https://github.com/apache/hudi/pull/13444#discussion_r2188528982


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/FileGroupRecordBuffer.java:
##########
@@ -565,27 +570,62 @@ protected boolean hasNextBaseRecord(T baseRecord, 
BufferedRecord<T> logRecordInf
       Pair<Boolean, T> isDeleteAndRecord = merge(baseRecordInfo, 
logRecordInfo);
       if (!isDeleteAndRecord.getLeft()) {
         // Updates
-        nextRecord = readerContext.seal(isDeleteAndRecord.getRight());
+        nextRecord = 
readerContext.seal(applyOutputSchemaConversion(isDeleteAndRecord.getRight()));
+        // If the record is not the same as the base record, we can emit an 
update
+        if (isDeleteAndRecord.getRight() != baseRecord) {
+          callbackOption.ifPresent(callback -> {
+            BufferedRecord<T> mergeResult = 
BufferedRecord.forRecordWithContext(nextRecord, 
readerContext.getSchemaHandler().getRequestedSchema(), readerContext, 
orderingFieldName, false);
+            
callback.onUpdate(readerContext.constructHoodieRecord(applyOutputSchemaConversion(baseRecordInfo)),
 
readerContext.constructHoodieRecord(applyOutputSchemaConversion(logRecordInfo)),
+                
readerContext.constructHoodieRecord(applyOutputSchemaConversion(mergeResult)));
+          });
+        }
         readStats.incrementNumUpdates();
         return true;
-      } else if (emitDelete) {
-        // emit Deletes
-        nextRecord = readerContext.getDeleteRow(isDeleteAndRecord.getRight(), 
baseRecordInfo.getRecordKey());
-        readStats.incrementNumDeletes();
-        return nextRecord != null;
       } else {
-        // not emit Deletes
+        // emit Deletes
+        callbackOption.ifPresent(callback -> 
callback.onDelete(readerContext.constructHoodieRecord(applyOutputSchemaConversion(baseRecordInfo)),
+            
readerContext.constructHoodieRecord(applyOutputSchemaConversion(logRecordInfo))));

Review Comment:
   The deletes are not always stored in a delete log block, we can also have 
merging logic that infers a delete based off of a field like we do for Postgres 
CDC workloads.



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to