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


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/BufferedRecordMergerFactory.java:
##########
@@ -512,6 +512,16 @@ private static <T> boolean 
shouldKeepNewerRecord(BufferedRecord<T> oldRecord, Bu
       // The orderingVal is constant 0 (int) and not guaranteed to match the 
type of the old or new record's ordering value.
       return true;
     }
-    return 
newRecord.getOrderingValue().compareTo(oldRecord.getOrderingValue()) >= 0;
+    Comparable oldOrderingVal = oldRecord.getOrderingValue();
+    Comparable newOrderingVal = newRecord.getOrderingValue();
+    // Checks the ordering value does not equal to 0
+    // because we use 0 as the default value which means natural order.
+    // OrderingValues#create coerces a null ordering field value to that 
default, so its class need

Review Comment:
   This is not the case, currently we have a special handling for SQL `DELETE` 
statements to hardcode the ordeirng value as 0, and that is the only special 
case.
   
   For table that does not declare any ordering values, all the ordering values 
are assigned as 0 to they got the same class.
   
   In the other cases, the ordering value is just null if the field value 
itself is null.



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