Skip to content

Commit

Permalink
Rename computeCompaction methods to avoid ambiguous java compiler err…
Browse files Browse the repository at this point in the history
…or if they are passed null. Other minor cleanup.
  • Loading branch information
Agustin Gonzalez committed May 20, 2022
1 parent 2945222 commit 59aa6d7
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,40 +280,25 @@ public IngestionMode getIngestionMode()
return ingestionMode;
}

protected static IngestionMode computeIngestionMode(@Nullable CompactionIOConfig ioConfig)
protected static IngestionMode computeCompactionIngestionMode(@Nullable CompactionIOConfig ioConfig)
{
final boolean isAppendToExisting;
final boolean isDropExisting;

if (ioConfig == null) {
isAppendToExisting = BatchIOConfig.DEFAULT_APPEND_EXISTING;
isDropExisting = BatchIOConfig.DEFAULT_DROP_EXISTING;
} else {
isAppendToExisting = BatchIOConfig.DEFAULT_APPEND_EXISTING;
isDropExisting = ioConfig.isDropExisting();
}

// CompactionIOConfig does not have an isAppendToExisting method, so use default (for batch since compaction
// is basically batch ingestion)
final boolean isAppendToExisting = BatchIOConfig.DEFAULT_APPEND_EXISTING;
final boolean isDropExisting = ioConfig == null ? BatchIOConfig.DEFAULT_DROP_EXISTING : ioConfig.isDropExisting();
return computeIngestionMode(isAppendToExisting, isDropExisting);
}

protected static IngestionMode computeIngestionMode(@Nullable BatchIOConfig ioConfig)
protected static IngestionMode computeBatchIngestionMode(@Nullable BatchIOConfig ioConfig)
{
final boolean isAppendToExisting;
final boolean isDropExisting;

if (ioConfig == null) {
isAppendToExisting = BatchIOConfig.DEFAULT_APPEND_EXISTING;
isDropExisting = BatchIOConfig.DEFAULT_DROP_EXISTING;
} else {
isAppendToExisting = ioConfig.isAppendToExisting();
isDropExisting = ioConfig.isDropExisting();
}

final boolean isAppendToExisting = ioConfig == null
? BatchIOConfig.DEFAULT_APPEND_EXISTING
: ioConfig.isAppendToExisting();
final boolean isDropExisting = ioConfig == null ? BatchIOConfig.DEFAULT_DROP_EXISTING : ioConfig.isDropExisting();
return computeIngestionMode(isAppendToExisting, isDropExisting);

}

protected static IngestionMode computeIngestionMode(boolean isAppendToExisting, boolean isDropExisting)
private static IngestionMode computeIngestionMode(boolean isAppendToExisting, boolean isDropExisting)
{
if (!isAppendToExisting && isDropExisting) {
return IngestionMode.REPLACE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public CompactionTask(
dataSource,
context,
-1,
computeIngestionMode(ioConfig)
computeCompactionIngestionMode(ioConfig)
);
Checks.checkOneNotNullOrEmpty(
ImmutableList.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public IndexTask(
id,
makeGroupId(
ingestionSchema,
computeIngestionMode(ingestionSchema.getIOConfig())
computeBatchIngestionMode(ingestionSchema.getIOConfig())
),
taskResource,
ingestionSchema.dataSchema.getDataSource(),
Expand Down Expand Up @@ -225,7 +225,7 @@ public IndexTask(
dataSource,
context,
maxAllowedLockCount,
computeIngestionMode(ingestionSchema.getIOConfig())
computeBatchIngestionMode(ingestionSchema.getIOConfig())
);
this.baseSequenceName = baseSequenceName == null ? getId() : baseSequenceName;
this.ingestionSchema = ingestionSchema;
Expand Down Expand Up @@ -1085,7 +1085,7 @@ public IndexIngestionSpec(
throw new IAE("Cannot use parser and inputSource together. Try using inputFormat instead of parser.");
}

IngestionMode ingestionMode = AbstractTask.computeIngestionMode(ioConfig);
IngestionMode ingestionMode = AbstractTask.computeBatchIngestionMode(ioConfig);

if (ingestionMode == IngestionMode.REPLACE && dataSchema.getGranularitySpec()
.inputIntervals()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public ParallelIndexSupervisorTask(
ingestionSchema.getDataSchema().getDataSource(),
context,
ingestionSchema.getTuningConfig().getMaxAllowedLockCount(),
computeIngestionMode(ingestionSchema.getIOConfig())
computeBatchIngestionMode(ingestionSchema.getIOConfig())
);

this.ingestionSchema = ingestionSchema;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public SinglePhaseSubTask(
taskResource,
ingestionSchema.getDataSchema().getDataSource(),
context,
AbstractTask.computeIngestionMode(ingestionSchema.getIOConfig())
AbstractTask.computeBatchIngestionMode(ingestionSchema.getIOConfig())
);

if (ingestionSchema.getTuningConfig().isForceGuaranteedRollup()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ public TaskStatus run(final TaskToolbox toolbox) throws Exception
new SupervisorTaskAccess(getSupervisorTaskId(), taskClient),
getIngestionSchema().getDataSchema(),
getTaskLockHelper(),
AbstractTask.computeIngestionMode(getIngestionSchema().getIOConfig()),
AbstractTask.computeBatchIngestionMode(getIngestionSchema().getIOConfig()),
partitionsSpec,
true
);
Expand Down

0 comments on commit 59aa6d7

Please sign in to comment.