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


##########
hudi-common/src/main/java/org/apache/hudi/common/util/OrderingValues.java:
##########
@@ -114,7 +114,26 @@ public static List<Comparable> getValues(ArrayComparable 
orderingValue) {
     return orderingValue.getValues();
   }
 
-  public static boolean isCommitTimeOrderingValue(Comparable orderingValue) {
+  public static boolean isNullOrDefault(Comparable orderingValue) {
     return orderingValue == null || OrderingValues.isDefault(orderingValue);
   }
+
+  /**
+   * Returns whether {@code baseOrderingValue} strictly outranks {@code 
incomingOrderingValue} under
+   * event-time ordering. A null or default (commit-time) base ordering value 
ranks lowest, so this
+   * returns {@code false} and the incoming record wins by natural order. The 
incoming ordering value
+   * is expected to be a real value; callers that may pass a null or default 
incoming value (for
+   * example delete records) must guard for it before calling. Two non-null 
values of different
+   * classes are not comparable and throw {@link IllegalArgumentException}.
+   */
+  public static boolean isBaseOrderingHigher(Comparable baseOrderingValue, 
Comparable incomingOrderingValue) {
+    if (isNullOrDefault(baseOrderingValue)) {

Review Comment:
   This is a behavior change from previous.
   For non-delete records, their ordering values are not supposed to be null.
   This change tolerates the null value for ordering values, as could be 
dangerous.



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