You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2020/08/27 18:40:06 UTC

[GitHub] [hudi] satishkotha commented on a change in pull request #2044: [HUDI-1228] Add utility method to query extra metadata

satishkotha commented on a change in pull request #2044:
URL: https://github.com/apache/hudi/pull/2044#discussion_r478620546



##########
File path: hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimelineUtils.java
##########
@@ -98,4 +101,31 @@
 
     }).distinct().filter(s -> !s.isEmpty()).collect(Collectors.toList());
   }
+
+  /**
+   * Get extra metadata for specified key from latest commit/deltacommit instant.
+   */
+  public static Option<String> getExtraMetadataFromLatest(HoodieTableMetaClient metaClient, String extraMetadataKey) {
+    return metaClient.getCommitsTimeline().filterCompletedInstants().getReverseOrderedInstants().findFirst().map(instant ->
+        getMetadataValue(metaClient, extraMetadataKey, instant)).orElse(Option.empty());
+  }
+
+  /**
+   * Get extra metadata for specified key from all active commit/deltacommit instants.
+   */
+  public static Map<String, Option<String>> getExtraMetadataTimeline(HoodieTableMetaClient metaClient, String extraMetadataKey) {

Review comment:
       This is primarily for debugging. This helps with seeing how extra metadata value changed over time.  If you have better suggestion for a name, let me know




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org