linliu-code commented on code in PR #13115:
URL: https://github.com/apache/hudi/pull/13115#discussion_r2037970322


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/FileGroupRecordBuffer.java:
##########
@@ -504,6 +529,19 @@ protected Option<T> merge(Option<T> older, Map<String, 
Object> olderInfoMap,
     }
   }
 
+  /**
+   * Decides whether to keep the incoming record with ordering value 
comparison.
+   */
+  private boolean shouldKeepNewerRecord(Option<T> oldVal, Map<String, Object> 
oldMetadata, Option<T> newVal, Map<String, Object> newMetadata) {
+    Comparable newOrderingVal = readerContext.getOrderingValue(newVal, 
newMetadata, readerSchema, orderingFieldName);
+    if (isDeleteRecordWithNaturalOrder(newVal, newOrderingVal)) {
+      // handle records coming from DELETE statements(the orderingVal is 
constant 0)
+      return true;
+    }
+    Comparable oldOrderingVal = readerContext.getOrderingValue(oldVal, 
oldMetadata, readerSchema, orderingFieldName);
+    return newOrderingVal.compareTo(oldOrderingVal) >= 0;

Review Comment:
   Meanwhile, a more fundamental question: Why does merge mode is solely based 
on time: commit time, event time? should the ordering field be any random 
column?



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