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


##########
hudi-common/src/main/java/org/apache/hudi/common/util/OrderingValues.java:
##########
@@ -117,4 +117,40 @@ public static List<Comparable> getValues(ArrayComparable 
orderingValue) {
   public static boolean isCommitTimeOrderingValue(Comparable orderingValue) {
     return orderingValue == null || OrderingValues.isDefault(orderingValue);
   }
+
+  /**
+   * Returns whether the base (older) ordering value strictly outranks the 
incoming (newer) one under event-time
+   * ordering, so that ties keep the incoming record.
+   *
+   * <p>A base value that is null, or that is the default value while the 
incoming value has another class, carries
+   * no ordering position (a null stored in the ordering column) and ranks 
below any incoming value. Multi-field
+   * ordering values apply this per field. Any other pair of values of 
different classes cannot be ordered and fails
+   * with an {@link IllegalArgumentException}.
+   */
+  public static boolean isBaseOrderingHigher(Comparable baseOrderingValue, 
Comparable incomingOrderingValue) {
+    return compareBaseToIncoming(baseOrderingValue, incomingOrderingValue) > 0;
+  }
+
+  private static int compareBaseToIncoming(Comparable base, Comparable 
incoming) {
+    if (base instanceof ArrayComparable && incoming instanceof 
ArrayComparable) {

Review Comment:
   So we basically allow ordering fields to be nullalbe now?
   
   We can fix ArrayComparable.compareTo for enforce null handlings instead of 
here so we can get rid of these special `instanceof` check.



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