yihua commented on code in PR #12826:
URL: https://github.com/apache/hudi/pull/12826#discussion_r1975961078
##########
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:
The supplier pattern seems redundant to me. Is it for throwing exception?
Could the compaction plan instance be directly passed in for upgrade here?
--
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]