yihua commented on code in PR #12826:
URL: https://github.com/apache/hudi/pull/12826#discussion_r1976245410


##########
hudi-common/src/main/java/org/apache/hudi/common/util/CompactionUtils.java:
##########
@@ -185,17 +187,27 @@ 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));
+  public static HoodieCompactionPlan getCompactionPlan(HoodieTableMetaClient 
metaClient, HoodieInstant requestedInstant) {
+    return getCompactionPlanInternal(metaClient, () -> 
metaClient.getActiveTimeline().loadCompactionPlan(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, InputStream planContent) {
+    return getCompactionPlanInternal(metaClient, () -> 
deserializeAvroMetadata(planContent, HoodieCompactionPlan.class));
+  }
+
+  @FunctionalInterface
+  private interface ThrowingSupplier<T, E extends Exception> {
+    T get() throws E;
+  }
+
+  private static HoodieCompactionPlan 
getCompactionPlanInternal(HoodieTableMetaClient metaClient, 
+      ThrowingSupplier<HoodieCompactionPlan, IOException> planSupplier) {

Review Comment:
   There are 2 callers and they use different way constructing 
HoodieCompactionPlan.



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

Reply via email to