Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JingsongLi committed Jan 24, 2024
1 parent 170509b commit 9591397
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ChangelogMergeTreeRewriter(
protected abstract boolean rewriteChangelog(
int outputLevel, boolean dropDelete, List<List<SortedRun>> sections);

protected abstract UpgradeChangelog upgradeChangelog(int outputLevel, DataFileMeta file);
protected abstract UpgradeStrategy upgradeChangelog(int outputLevel, DataFileMeta file);

protected abstract MergeFunctionWrapper<ChangelogResult> createMergeWrapper(int outputLevel);

Expand Down Expand Up @@ -164,7 +164,7 @@ private CompactResult rewriteChangelogCompaction(

@Override
public CompactResult upgrade(int outputLevel, DataFileMeta file) throws Exception {
UpgradeChangelog strategy = upgradeChangelog(outputLevel, file);
UpgradeStrategy strategy = upgradeChangelog(outputLevel, file);
if (strategy.changelog) {
return rewriteChangelogCompaction(
outputLevel,
Expand All @@ -177,15 +177,15 @@ public CompactResult upgrade(int outputLevel, DataFileMeta file) throws Exceptio
}

/** Strategy for upgrade. */
protected enum UpgradeChangelog {
protected enum UpgradeStrategy {
NO_CHANGELOG(false, false),
CHANGELOG_NO_REWRITE(true, false),
CHANGELOG_WITH_REWRITE(true, true);

private final boolean changelog;
private final boolean rewrite;

UpgradeChangelog(boolean changelog, boolean rewrite) {
UpgradeStrategy(boolean changelog, boolean rewrite) {
this.changelog = changelog;
this.rewrite = rewrite;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import java.util.Comparator;
import java.util.List;

import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeChangelog.CHANGELOG_NO_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeChangelog.CHANGELOG_WITH_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeChangelog.NO_CHANGELOG;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeStrategy.CHANGELOG_NO_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeStrategy.CHANGELOG_WITH_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeStrategy.NO_CHANGELOG;
import static org.apache.paimon.utils.Preconditions.checkArgument;

/**
Expand Down Expand Up @@ -80,7 +80,7 @@ protected boolean rewriteChangelog(
}

@Override
protected UpgradeChangelog upgradeChangelog(int outputLevel, DataFileMeta file) {
protected UpgradeStrategy upgradeChangelog(int outputLevel, DataFileMeta file) {
if (file.level() != 0) {
return NO_CHANGELOG;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import java.util.Comparator;
import java.util.List;

import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeChangelog.CHANGELOG_NO_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeChangelog.NO_CHANGELOG;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeStrategy.CHANGELOG_NO_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeStrategy.NO_CHANGELOG;

/** A {@link MergeTreeCompactRewriter} which produces changelog files for each full compaction. */
public class FullChangelogMergeTreeCompactRewriter extends ChangelogMergeTreeRewriter {
Expand Down Expand Up @@ -74,7 +74,7 @@ protected boolean rewriteChangelog(
}

@Override
protected UpgradeChangelog upgradeChangelog(int outputLevel, DataFileMeta file) {
protected UpgradeStrategy upgradeChangelog(int outputLevel, DataFileMeta file) {
return outputLevel == maxLevel ? CHANGELOG_NO_REWRITE : NO_CHANGELOG;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import java.util.Comparator;
import java.util.List;

import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeChangelog.CHANGELOG_NO_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeChangelog.CHANGELOG_WITH_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeChangelog.NO_CHANGELOG;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeStrategy.CHANGELOG_NO_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeStrategy.CHANGELOG_WITH_REWRITE;
import static org.apache.paimon.mergetree.compact.ChangelogMergeTreeRewriter.UpgradeStrategy.NO_CHANGELOG;

/**
* A {@link MergeTreeCompactRewriter} which produces changelog files by lookup for the compaction
Expand Down Expand Up @@ -77,7 +77,7 @@ protected boolean rewriteChangelog(
}

@Override
protected UpgradeChangelog upgradeChangelog(int outputLevel, DataFileMeta file) {
protected UpgradeStrategy upgradeChangelog(int outputLevel, DataFileMeta file) {
if (file.level() != 0) {
return NO_CHANGELOG;
}
Expand Down

0 comments on commit 9591397

Please sign in to comment.