linliu-code commented on code in PR #12122:
URL: https://github.com/apache/hudi/pull/12122#discussion_r1807204436
##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieBaseFileGroupRecordBuffer.java:
##########
@@ -278,14 +289,19 @@ protected Option<DeleteRecord>
doProcessNextDeletedRecord(DeleteRecord deleteRec
if
(isDeleteRecordWithNaturalOrder(existingRecordMetadataPair.getLeft(),
existingOrderingVal)) {
return Option.empty();
}
- Comparable deleteOrderingVal = deleteRecord.getOrderingValue();
- // Checks the ordering value does not equal to 0
- // because we use 0 as the default value which means natural order
- boolean chooseExisting = !deleteOrderingVal.equals(0)
- && ReflectionUtils.isSameClass(existingOrderingVal,
deleteOrderingVal)
- && existingOrderingVal.compareTo(deleteOrderingVal) > 0;
+ Comparable deleteOrderingVal = readerContext.getOrderingValue(
+ Option.empty(), Collections.emptyMap(), readerSchema,
orderingFieldName, orderingFieldType, orderingFieldDefault);
+ deleteOrderingVal = deleteRecord.getOrderingValue() == null ?
deleteOrderingVal : deleteRecord.getOrderingValue();
Review Comment:
The default ordering value like (0) should be lower than the new inserted
records with the same key, then the delete records are lost. Therefore, we have
to use some extra flag to remember if a delete without valid ordering value
exists.
--
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]