Davis-Zhang-Onehouse commented on code in PR #12826:
URL: https://github.com/apache/hudi/pull/12826#discussion_r1964169097
##########
hudi-common/src/main/java/org/apache/hudi/common/util/CompactionUtils.java:
##########
@@ -186,16 +187,36 @@ public static HoodieCompactionPlan
getLogCompactionPlan(HoodieTableMetaClient me
* Util method to fetch both compaction and log compaction plan from
requestedInstant.
*/
private static HoodieCompactionPlan getCompactionPlan(HoodieTableMetaClient
metaClient, HoodieInstant requestedInstant) {
- return getCompactionPlan(metaClient,
metaClient.getActiveTimeline().readCompactionPlanAsBytes(requestedInstant));
+ return getCompactionPlan(metaClient,
metaClient.getActiveTimeline().getInstantContentStream(requestedInstant));
}
/**
* Util method to fetch both compaction and log compaction plan from
requestedInstant.
*/
- public static HoodieCompactionPlan getCompactionPlan(HoodieTableMetaClient
metaClient, Option<byte[]> planContent) {
+ public static HoodieCompactionPlan getCompactionPlan(HoodieTableMetaClient
metaClient, Option<InputStream> planContent) {
CompactionPlanMigrator migrator = new CompactionPlanMigrator(metaClient);
try {
- HoodieCompactionPlan compactionPlan =
TimelineMetadataUtils.deserializeCompactionPlan(planContent.get());
+ HoodieCompactionPlan compactionPlan =
TimelineMetadataUtils.deserializeCompactionPlan(planContent);
+ return migrator.upgradeToLatest(compactionPlan,
compactionPlan.getVersion());
+ } catch (IOException e) {
+ throw new HoodieException(e);
+ }
+ }
+
+ public static HoodieCompactionPlan
getCompactionPlanLegacy(HoodieTableMetaClient metaClient, byte[] bytes) {
+ CompactionPlanMigrator migrator = new CompactionPlanMigrator(metaClient);
+ try {
+ HoodieCompactionPlan compactionPlan =
TimelineMetadataUtils.deserializeCompactionPlanLegacy(bytes);
+ return migrator.upgradeToLatest(compactionPlan,
compactionPlan.getVersion());
+ } catch (IOException e) {
+ throw new HoodieException(e);
+ }
+ }
+
+ public static HoodieCompactionPlan
getCompactionPlanFromInputStream(HoodieTableMetaClient metaClient,
Option<InputStream> in) {
Review Comment:
removed
--
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]