[HUDI-2990] Sync to HMS when deleting partitions (#4291)
This commit is contained in:
@@ -414,6 +414,25 @@ public class TableSchemaResolver {
|
||||
return latestSchema;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Last commit's Metadata.
|
||||
*/
|
||||
public Option<HoodieCommitMetadata> getLatestCommitMetadata() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the parquet schema from a parquet File.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user