yihua commented on code in PR #12122:
URL: https://github.com/apache/hudi/pull/12122#discussion_r1819817879


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergedReadHandle.java:
##########
@@ -166,6 +167,17 @@ private List<HoodieRecord<T>> 
doMergedRead(Option<HoodieFileReader> baseFileRead
         String key = record.getRecordKey();
         if (deltaRecordMap.containsKey(key)) {
           deltaRecordKeys.remove(key);
+
+          // When we find a processing time based delete, e.g., a delete 
record without valid ordering value,
+          // or with default ordering value, i.e., 0, we can safely ignore 
records before the delete record.
+          // That means, we can return the log record without merging with the 
record from base file.
+          if 
(deltaRecordMap.get(key).getMetaDataInfo(DELETE_FOUND_WITHOUT_ORDERING_VALUE).isPresent())
 {
+            if (!deltaRecordMap.get(key).isDelete(readerSchema, 
config.getProps())) {
+              mergedRecords.add(deltaRecordMap.get(key));
+            }
+            continue;
+          }

Review Comment:
   Similar here: could `recordMerger` handle this directly?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergedReadHandle.java:
##########
@@ -166,6 +167,17 @@ private List<HoodieRecord<T>> 
doMergedRead(Option<HoodieFileReader> baseFileRead
         String key = record.getRecordKey();
         if (deltaRecordMap.containsKey(key)) {
           deltaRecordKeys.remove(key);
+
+          // When we find a processing time based delete, e.g., a delete 
record without valid ordering value,
+          // or with default ordering value, i.e., 0, we can safely ignore 
records before the delete record.
+          // That means, we can return the log record without merging with the 
record from base file.
+          if 
(deltaRecordMap.get(key).getMetaDataInfo(DELETE_FOUND_WITHOUT_ORDERING_VALUE).isPresent())
 {
+            if (!deltaRecordMap.get(key).isDelete(readerSchema, 
config.getProps())) {

Review Comment:
   I assume only deletes enter here so there is no need to check whether the 
delta record is a delete or not.



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