suryaprasanna commented on code in PR #18489:
URL: https://github.com/apache/hudi/pull/18489#discussion_r3075841103


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimelineUtils.java:
##########
@@ -647,4 +647,28 @@ public static <T> Option<HoodieInstantWriter> 
getHoodieInstantWriterOption(Hoodi
     }
     return writerOption;
   }
+
+  public static Option<Pair<String, HoodieCommitMetadata>> 
getLatestInstantAndCommitMetadataWithValidCheckpointInfo(HoodieTimeline 
timeline,
+                                                                               
                                     String... checkpointKeys) throws 
IOException {
+    return (Option<Pair<String, HoodieCommitMetadata>>) 
timeline.getReverseOrderedInstants().map(instant -> {
+      try {
+        HoodieCommitMetadata commitMetadata = HoodieCommitMetadata
+            .fromBytes(timeline.getInstantDetails(instant).get(), 
HoodieCommitMetadata.class);
+        boolean hasCheckpointMetadata = false;
+        for (String checkpointKey : checkpointKeys) {
+          if 
(!StringUtils.isNullOrEmpty(commitMetadata.getMetadata(checkpointKey))) {
+            hasCheckpointMetadata = true;
+            break;
+          }
+        }
+        if (hasCheckpointMetadata) {

Review Comment:
   Done.



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