@Test public void testBuildFromFileSlices() { Pair<List<Pair<String, FileSlice>>, HoodieCompactionPlan> inputAndPlan = buildCompactionPlan(); testFileSlicesCompactionPlanEquality(inputAndPlan.getKey(), inputAndPlan.getValue()); }
public static HoodieCompactionPlan buildFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs, Option<Map<String, String>> extraMetadata, Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction) { HoodieCompactionPlan.Builder builder = HoodieCompactionPlan.newBuilder(); extraMetadata.ifPresent(builder::setExtraMetadata); builder.setOperations(partitionFileSlicePairs.stream() .map(pfPair -> buildFromFileSlice(pfPair.getKey(), pfPair.getValue(), metricsCaptureFunction)) .collect(Collectors.toList())); builder.setVersion(LATEST_COMPACTION_METADATA_VERSION); return builder.build(); }
CompactionUtils { public static HoodieCompactionPlan buildFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs, Option<Map<String, String>> extraMetadata, Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction) { HoodieCompactionPlan.Builder builder = HoodieCompactionPlan.newBuilder(); extraMetadata.ifPresent(builder::setExtraMetadata); builder.setOperations(partitionFileSlicePairs.stream() .map(pfPair -> buildFromFileSlice(pfPair.getKey(), pfPair.getValue(), metricsCaptureFunction)) .collect(Collectors.toList())); builder.setVersion(LATEST_COMPACTION_METADATA_VERSION); return builder.build(); } }
CompactionUtils { public static HoodieCompactionPlan buildFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs, Option<Map<String, String>> extraMetadata, Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction) { HoodieCompactionPlan.Builder builder = HoodieCompactionPlan.newBuilder(); extraMetadata.ifPresent(builder::setExtraMetadata); builder.setOperations(partitionFileSlicePairs.stream() .map(pfPair -> buildFromFileSlice(pfPair.getKey(), pfPair.getValue(), metricsCaptureFunction)) .collect(Collectors.toList())); builder.setVersion(LATEST_COMPACTION_METADATA_VERSION); return builder.build(); }  }
CompactionUtils { public static HoodieCompactionPlan buildFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs, Option<Map<String, String>> extraMetadata, Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction) { HoodieCompactionPlan.Builder builder = HoodieCompactionPlan.newBuilder(); extraMetadata.ifPresent(builder::setExtraMetadata); builder.setOperations(partitionFileSlicePairs.stream() .map(pfPair -> buildFromFileSlice(pfPair.getKey(), pfPair.getValue(), metricsCaptureFunction)) .collect(Collectors.toList())); builder.setVersion(LATEST_COMPACTION_METADATA_VERSION); return builder.build(); }  static HoodieCompactionOperation buildFromFileSlice(String partitionPath, FileSlice fileSlice,
      Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction); static HoodieCompactionPlan buildFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs,
      Option<Map<String, String>> extraMetadata,
      Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction); static HoodieCompactionOperation buildHoodieCompactionOperation(CompactionOperation op); static CompactionOperation buildCompactionOperation(HoodieCompactionOperation hc); static List<Pair<HoodieInstant, HoodieCompactionPlan>> getAllPendingCompactionPlans(
      HoodieTableMetaClient metaClient); static HoodieCompactionPlan getCompactionPlan(HoodieTableMetaClient metaClient, String compactionInstant); static Map<HoodieFileGroupId, Pair<String, HoodieCompactionOperation>> getAllPendingCompactionOperations(
      HoodieTableMetaClient metaClient); static Stream<Pair<HoodieFileGroupId, Pair<String, HoodieCompactionOperation>>> getPendingCompactionOperations(
      HoodieInstant instant, HoodieCompactionPlan compactionPlan); static List<HoodieInstant> getPendingCompactionInstantTimes(HoodieTableMetaClient metaClient); }
CompactionUtils { public static HoodieCompactionPlan buildFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs, Option<Map<String, String>> extraMetadata, Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction) { HoodieCompactionPlan.Builder builder = HoodieCompactionPlan.newBuilder(); extraMetadata.ifPresent(builder::setExtraMetadata); builder.setOperations(partitionFileSlicePairs.stream() .map(pfPair -> buildFromFileSlice(pfPair.getKey(), pfPair.getValue(), metricsCaptureFunction)) .collect(Collectors.toList())); builder.setVersion(LATEST_COMPACTION_METADATA_VERSION); return builder.build(); }  static HoodieCompactionOperation buildFromFileSlice(String partitionPath, FileSlice fileSlice,
      Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction); static HoodieCompactionPlan buildFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs,
      Option<Map<String, String>> extraMetadata,
      Option<Function<Pair<String, FileSlice>, Map<String, Double>>> metricsCaptureFunction); static HoodieCompactionOperation buildHoodieCompactionOperation(CompactionOperation op); static CompactionOperation buildCompactionOperation(HoodieCompactionOperation hc); static List<Pair<HoodieInstant, HoodieCompactionPlan>> getAllPendingCompactionPlans(
      HoodieTableMetaClient metaClient); static HoodieCompactionPlan getCompactionPlan(HoodieTableMetaClient metaClient, String compactionInstant); static Map<HoodieFileGroupId, Pair<String, HoodieCompactionOperation>> getAllPendingCompactionOperations(
      HoodieTableMetaClient metaClient); static Stream<Pair<HoodieFileGroupId, Pair<String, HoodieCompactionOperation>>> getPendingCompactionOperations(
      HoodieInstant instant, HoodieCompactionPlan compactionPlan); static List<HoodieInstant> getPendingCompactionInstantTimes(HoodieTableMetaClient metaClient); static final Integer COMPACTION_METADATA_VERSION_1; static final Integer COMPACTION_METADATA_VERSION_2; static final Integer LATEST_COMPACTION_METADATA_VERSION; }