Search in sources :

Example 6 with HoodieActionInstant

use of org.apache.hudi.avro.model.HoodieActionInstant in project hudi by apache.

the class HoodieClientTestHarness method createCleanMetadata.

public HoodieInstant createCleanMetadata(String instantTime, boolean inflightOnly, boolean isEmpty) throws IOException {
    HoodieCleanerPlan cleanerPlan = new HoodieCleanerPlan(new HoodieActionInstant("", "", ""), "", new HashMap<>(), CleanPlanV2MigrationHandler.VERSION, new HashMap<>());
    if (inflightOnly) {
        HoodieTestTable.of(metaClient).addInflightClean(instantTime, cleanerPlan);
    } else {
        HoodieCleanStat cleanStats = new HoodieCleanStat(HoodieCleaningPolicy.KEEP_LATEST_FILE_VERSIONS, HoodieTestUtils.DEFAULT_PARTITION_PATHS[new Random().nextInt(HoodieTestUtils.DEFAULT_PARTITION_PATHS.length)], Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), instantTime);
        HoodieCleanMetadata cleanMetadata = convertCleanMetadata(instantTime, Option.of(0L), Collections.singletonList(cleanStats));
        HoodieTestTable.of(metaClient).addClean(instantTime, cleanerPlan, cleanMetadata, isEmpty);
    }
    return new HoodieInstant(inflightOnly, "clean", instantTime);
}
Also used : HoodieInstant(org.apache.hudi.common.table.timeline.HoodieInstant) HoodieCleanStat(org.apache.hudi.common.HoodieCleanStat) Random(java.util.Random) HoodieCleanMetadata(org.apache.hudi.avro.model.HoodieCleanMetadata) HoodieActionInstant(org.apache.hudi.avro.model.HoodieActionInstant) HoodieCleanerPlan(org.apache.hudi.avro.model.HoodieCleanerPlan)

Aggregations

HoodieActionInstant (org.apache.hudi.avro.model.HoodieActionInstant)6 HoodieCleanerPlan (org.apache.hudi.avro.model.HoodieCleanerPlan)6 HoodieCleanStat (org.apache.hudi.common.HoodieCleanStat)5 HoodieCleanMetadata (org.apache.hudi.avro.model.HoodieCleanMetadata)4 List (java.util.List)3 Map (java.util.Map)3 HoodieInstant (org.apache.hudi.common.table.timeline.HoodieInstant)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Random (java.util.Random)2 Collectors (java.util.stream.Collectors)2 HoodieEngineContext (org.apache.hudi.common.engine.HoodieEngineContext)2 HoodieRecordPayload (org.apache.hudi.common.model.HoodieRecordPayload)2 TimelineMetadataUtils (org.apache.hudi.common.table.timeline.TimelineMetadataUtils)2 CleanerUtils (org.apache.hudi.common.util.CleanerUtils)2 Option (org.apache.hudi.common.util.Option)2 Pair (org.apache.hudi.common.util.collection.Pair)2 HoodieWriteConfig (org.apache.hudi.config.HoodieWriteConfig)2 HoodieIOException (org.apache.hudi.exception.HoodieIOException)2