XuQianJin-Stars commented on code in PR #5178: URL: https://github.com/apache/hudi/pull/5178#discussion_r841318795
########## hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java: ########## @@ -1331,4 +1329,22 @@ private static boolean canCompare(Schema schema) { inflightAndCompletedPartitions.addAll(getCompletedMetadataPartitions(tableConfig)); return inflightAndCompletedPartitions; } + + /** + * Get Last commit's Metadata. + */ + public static Option<HoodieCommitMetadata> getLatestCommitMetadata(HoodieTableMetaClient metaClient) { + try { + HoodieTimeline timeline = metaClient.getActiveTimeline().getCommitsTimeline().filterCompletedInstants(); + if (timeline.lastInstant().isPresent()) { + HoodieInstant instant = timeline.lastInstant().get(); + byte[] data = timeline.getInstantDetails(instant).get(); + return Option.of(HoodieCommitMetadata.fromBytes(data, HoodieCommitMetadata.class)); + } else { + return Option.empty(); + } + } catch (Exception e) { + throw new HoodieException("Failed to get commit metadata", e); + } + } Review Comment: > why move this method from TableSchemaResolver to this class @vinothchandar suggest extract this out to a separate static helper. -- 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: dev-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org