Source:
private TaskStatus runRangePartitionMultiPhaseParallel(TaskToolbox toolbox) throws Exception { assertDataSketchesAvailable(); ParallelIndexTaskRunner<PartialDimensionDistributionTask, DimensionDistributionReport> distributionRunner = createRunner( toolbox, this::createPartialDimensionDistributionRunner ); TaskState distributionState = runNextPhase(distributionRunner); if (distributionState.isFailure()) { return TaskStatus.failure(getId()); } Map<Interval, String[]> intervalToPartitions = determineAllRangePartitions(distributionRunner.getReports().values()); if (intervalToPartitions.isEmpty()) { String msg = "No valid rows for single dimension partitioning." + " All rows may have invalid timestamps or multiple dimension values."; LOG.warn(msg); return TaskStatus.success(getId(), msg); } ParallelIndexTaskRunner<PartialRangeSegmentGenerateTask, GeneratedPartitionsReport<GenericPartitionStat>> indexingRunner = createRunner(toolbox, tb -> createPartialRangeSegmentGenerateRunner(tb, intervalToPartitions)); TaskState indexingState = runNextPhase(indexingRunner); if (indexingState.isFailure()) { return TaskStatus.failure(getId()); } Map<Pair<Interval, Integer>, List<GenericPartitionLocation>> partitionToLocations = groupGenericPartitionLocationsPerPartition(indexingRunner.getReports()); final List<PartialGenericSegmentMergeIOConfig> ioConfigs = createGenericMergeIOConfigs( ingestionSchema.getTuningConfig().getTotalNumMergeTasks(), partitionToLocations ); ParallelIndexTaskRunner<PartialGenericSegmentMergeTask, PushedSegmentsReport> mergeRunner = createRunner( toolbox, tb -> createPartialGenericSegmentMergeRunner(tb, ioConfigs) ); TaskState mergeState = runNextPhase(mergeRunner); if (mergeState.isSuccess()) { publishSegments(toolbox, mergeRunner.getReports()); } return TaskStatus.fromCode(getId(), mergeState); }

Target:
private TaskStatus runRangePartitionMultiPhaseParallel(TaskToolbox toolbox) throws Exception { ParallelIndexTaskRunner<PartialDimensionDistributionTask, DimensionDistributionReport> distributionRunner = createRunner( toolbox, this::createPartialDimensionDistributionRunner ); TaskState distributionState = runNextPhase(distributionRunner); if (distributionState.isFailure()) { return TaskStatus.failure(getId(), PartialDimensionDistributionTask.TYPE + " failed"); } Map<Interval, PartitionBoundaries> intervalToPartitions = determineAllRangePartitions(distributionRunner.getReports().values()); if (intervalToPartitions.isEmpty()) { String msg = "No valid rows for single dimension partitioning." + " All rows may have invalid timestamps or multiple dimension values."; LOG.warn(msg); return TaskStatus.success(getId(), msg); } ParallelIndexTaskRunner<PartialRangeSegmentGenerateTask, GeneratedPartitionsReport<GenericPartitionStat>> indexingRunner = createRunner(toolbox, tb -> createPartialRangeSegmentGenerateRunner(tb, intervalToPartitions)); TaskState indexingState = runNextPhase(indexingRunner); if (indexingState.isFailure()) { return TaskStatus.failure(getId(), PartialRangeSegmentGenerateTask.TYPE + " failed"); } Map<Pair<Interval, Integer>, List<GenericPartitionLocation>> partitionToLocations = groupGenericPartitionLocationsPerPartition(indexingRunner.getReports()); final List<PartialGenericSegmentMergeIOConfig> ioConfigs = createGenericMergeIOConfigs( ingestionSchema.getTuningConfig().getTotalNumMergeTasks(), partitionToLocations ); ParallelIndexTaskRunner<PartialGenericSegmentMergeTask, PushedSegmentsReport> mergeRunner = createRunner( toolbox, tb -> createPartialGenericSegmentMergeRunner(tb, ioConfigs) ); TaskState mergeState = runNextPhase(mergeRunner); if (mergeState.isSuccess()) { publishSegments(toolbox, mergeRunner.getReports()); } return TaskStatus.fromCode(getId(), mergeState); }