linliu-code commented on code in PR #12122:
URL: https://github.com/apache/hudi/pull/12122#discussion_r1819843358
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java:
##########
@@ -355,22 +357,28 @@ public void write(HoodieRecord<T> oldRecord) {
// writing the first record. So make a copy of the record to be merged
HoodieRecord<T> newRecord = keyToNewRecords.get(key).newInstance();
try {
- Option<Pair<HoodieRecord, Schema>> mergeResult =
recordMerger.merge(oldRecord, oldSchema, newRecord, newSchema, props);
- Schema combineRecordSchema =
mergeResult.map(Pair::getRight).orElse(null);
- Option<HoodieRecord> combinedRecord = mergeResult.map(Pair::getLeft);
- if (combinedRecord.isPresent() &&
combinedRecord.get().shouldIgnore(combineRecordSchema, props)) {
- // If it is an IGNORE_RECORD, just copy the old record, and do not
update the new record.
- copyOldRecord = true;
- } else if (writeUpdateRecord(newRecord, oldRecord, combinedRecord,
combineRecordSchema)) {
- /*
- * ONLY WHEN 1) we have an update for this key AND 2) We are able to
successfully
- * write the combined new value
- *
- * We no longer need to copy the old record over.
- */
- copyOldRecord = false;
+ if
(keyToNewRecords.get(key).getMetaDataInfo(DELETE_FOUND_WITHOUT_ORDERING_VALUE).isPresent())
{
+ if (writeUpdateRecord(newRecord, oldRecord, Option.empty(),
newSchema)) {
+ copyOldRecord = false;
+ }
+ } else {
+ Option<Pair<HoodieRecord, Schema>> mergeResult =
recordMerger.merge(oldRecord, oldSchema, newRecord, newSchema, props);
Review Comment:
I was afraid that then we need to modify all the mergers (not sure how
many), and I am not sure how complex it will be.
--
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]