From b00dd84fa2523c1f71115e7bb31a293cba99dfc0 Mon Sep 17 00:00:00 2001 From: Clint Wylie Date: Wed, 11 Sep 2019 20:47:27 -0700 Subject: [PATCH] clarify error messaging for parallel indexing task when when missing numShards or intervals (#8513) --- .../parallel/ParallelIndexSupervisorTask.java | 15 ++++++++------- .../parallel/MultiPhaseParallelIndexingTest.java | 6 ++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java index 16ac6000f80..7f593aeddca 100644 --- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java +++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexSupervisorTask.java @@ -183,13 +183,14 @@ public class ParallelIndexSupervisorTask extends AbstractBatchIndexTask implemen throw new IAE("[%s] should implement FiniteFirehoseFactory", firehoseFactory.getClass().getSimpleName()); } - if (ingestionSchema.getTuningConfig().isForceGuaranteedRollup() - && (ingestionSchema.getTuningConfig().getNumShards() == null - || ingestionSchema.getDataSchema().getGranularitySpec().inputIntervals().isEmpty())) { - throw new ISE( - "forceGuaranteedRollup is set " - + "but numShards is missing in partitionsSpec or intervals is missing in granularitySpec" - ); + if (ingestionSchema.getTuningConfig().isForceGuaranteedRollup()) { + if (ingestionSchema.getTuningConfig().getNumShards() == null) { + throw new ISE("forceGuaranteedRollup is set but numShards is missing in partitionsSpec"); + } + + if (ingestionSchema.getDataSchema().getGranularitySpec().inputIntervals().isEmpty()) { + throw new ISE("forceGuaranteedRollup is set but intervals is missing in granularitySpec"); + } } this.baseFirehoseFactory = (FiniteFirehoseFactory) firehoseFactory; diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingTest.java index 6d9a49e4aba..ef2310a51a1 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingTest.java @@ -159,8 +159,7 @@ public class MultiPhaseParallelIndexingTest extends AbstractParallelIndexSupervi { expectedException.expect(IllegalStateException.class); expectedException.expectMessage( - "forceGuaranteedRollup is set but numShards is missing in partitionsSpec " - + "or intervals is missing in granularitySpec" + "forceGuaranteedRollup is set but intervals is missing in granularitySpec" ); newTask( null, @@ -177,8 +176,7 @@ public class MultiPhaseParallelIndexingTest extends AbstractParallelIndexSupervi { expectedException.expect(IllegalStateException.class); expectedException.expectMessage( - "forceGuaranteedRollup is set but numShards is missing in partitionsSpec " - + "or intervals is missing in granularitySpec" + "forceGuaranteedRollup is set but numShards is missing in partitionsSpec" ); newTask( Intervals.of("2017/2018"),