use of org.apache.hudi.avro.model.HoodieSavepointPartitionMetadata in project hudi by apache.
the class HoodieTestTable method getSavepointMetadata.
public HoodieSavepointMetadata getSavepointMetadata(String instant, Map<String, List<String>> partitionToFilesMeta) {
HoodieSavepointMetadata savepointMetadata = new HoodieSavepointMetadata();
savepointMetadata.setSavepointedAt(Long.valueOf(instant));
Map<String, HoodieSavepointPartitionMetadata> partitionMetadataMap = new HashMap<>();
for (Map.Entry<String, List<String>> entry : partitionToFilesMeta.entrySet()) {
HoodieSavepointPartitionMetadata savepointPartitionMetadata = new HoodieSavepointPartitionMetadata();
savepointPartitionMetadata.setPartitionPath(entry.getKey());
savepointPartitionMetadata.setSavepointDataFile(entry.getValue());
partitionMetadataMap.put(entry.getKey(), savepointPartitionMetadata);
}
savepointMetadata.setPartitionMetadata(partitionMetadataMap);
savepointMetadata.setSavepointedBy("test");
return savepointMetadata;
}
use of org.apache.hudi.avro.model.HoodieSavepointPartitionMetadata in project hudi by apache.
the class TimelineMetadataUtils method convertSavepointMetadata.
public static HoodieSavepointMetadata convertSavepointMetadata(String user, String comment, Map<String, List<String>> latestFiles) {
Map<String, HoodieSavepointPartitionMetadata> partitionMetadataBuilder = new HashMap<>();
for (Map.Entry<String, List<String>> stat : latestFiles.entrySet()) {
HoodieSavepointPartitionMetadata metadata = new HoodieSavepointPartitionMetadata(stat.getKey(), stat.getValue());
partitionMetadataBuilder.put(stat.getKey(), metadata);
}
return new HoodieSavepointMetadata(user, System.currentTimeMillis(), comment, Collections.unmodifiableMap(partitionMetadataBuilder), DEFAULT_VERSION);
}
Aggregations