Search in sources :

Example 1 with HoodieCleaningPolicy

use of org.apache.hudi.common.model.HoodieCleaningPolicy in project hudi by apache.

the class CleanPlanner method getDeletePaths.

/**
 * Returns files to be cleaned for the given partitionPath based on cleaning policy.
 */
public List<CleanFileInfo> getDeletePaths(String partitionPath) {
    HoodieCleaningPolicy policy = config.getCleanerPolicy();
    List<CleanFileInfo> deletePaths;
    if (policy == HoodieCleaningPolicy.KEEP_LATEST_COMMITS) {
        deletePaths = getFilesToCleanKeepingLatestCommits(partitionPath);
    } else if (policy == HoodieCleaningPolicy.KEEP_LATEST_FILE_VERSIONS) {
        deletePaths = getFilesToCleanKeepingLatestVersions(partitionPath);
    } else if (policy == HoodieCleaningPolicy.KEEP_LATEST_BY_HOURS) {
        deletePaths = getFilesToCleanKeepingLatestHours(partitionPath);
    } else {
        throw new IllegalArgumentException("Unknown cleaning policy : " + policy.name());
    }
    LOG.info(deletePaths.size() + " patterns used to delete in partition path:" + partitionPath);
    return deletePaths;
}
Also used : CleanFileInfo(org.apache.hudi.common.model.CleanFileInfo) HoodieCleaningPolicy(org.apache.hudi.common.model.HoodieCleaningPolicy)

Aggregations

CleanFileInfo (org.apache.hudi.common.model.CleanFileInfo)1 HoodieCleaningPolicy (org.apache.hudi.common.model.HoodieCleaningPolicy)1