vinothchandar commented on code in PR #19212:
URL: https://github.com/apache/hudi/pull/19212#discussion_r3568308203


##########
hudi-common/src/main/java/org/apache/hudi/common/util/CommitUtils.java:
##########
@@ -175,22 +176,13 @@ public static Set<Pair<String, String>> 
flattenPartitionToReplaceFileIds(Map<Str
    */
   public static Option<String> 
getValidCheckpointForCurrentWriter(HoodieTimeline timeline, String 
checkpointKey,
                                                                   String 
keyToLookup) {
-    return (Option<String>) 
timeline.getWriteTimeline().filterCompletedInstants().getReverseOrderedInstants()
-        .map(instant -> {
-          try {
-            HoodieCommitMetadata commitMetadata = 
timeline.readCommitMetadata(instant);
-            // process commits only with checkpoint entries
-            String checkpointValue = commitMetadata.getMetadata(checkpointKey);
-            if (StringUtils.nonEmpty(checkpointValue)) {
-              // return if checkpoint for "keyForLookup" exists.
-              return readCheckpointValue(checkpointValue, keyToLookup);
-            } else {
-              return Option.empty();
-            }
-          } catch (IOException e) {
-            throw new HoodieIOException("Failed to parse HoodieCommitMetadata 
for " + instant.toString(), e);
-          }
-        }).filter(Option::isPresent).findFirst().orElse(Option.empty());
+    return 
TimelineUtils.findLatestInCommitMetadata(timeline.getWriteTimeline().filterCompletedInstants(),

Review Comment:
   chcked



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