Source:
<code>public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { LOG.info("Run coordinator segment compactor"); final CoordinatorDynamicConfig dynamicConfig = params.getCoordinatorDynamicConfig(); final CoordinatorStats stats = new CoordinatorStats(); if (dynamicConfig.getMaxCompactionTaskSlots() > 0) { Map<String, VersionedIntervalTimeline<String, DataSegment>> dataSources = params.getDataSources(); List<CoordinatorCompactionConfig> compactionConfigList = dynamicConfig.getCompactionConfigs(); if (compactionConfigList != null && !compactionConfigList.isEmpty()) { Map<String, CoordinatorCompactionConfig> compactionConfigs = compactionConfigList .stream() .collect(Collectors.toMap(CoordinatorCompactionConfig::getDataSource, Function.identity())); final List<TaskStatusPlus> runningCompactTasks = indexingServiceClient .getRunningTasks() .stream() <START> .filter(status -> status.getType().equals("compact")) <END> .collect(Collectors.toList()); final CompactionSegmentIterator iterator = policy.reset(compactionConfigs, dataSources); final int compactionTaskCapacity = (int) Math.min( indexingServiceClient.getTotalWorkerCapacity() * dynamicConfig.getCompactionTaskSlotRatio(), dynamicConfig.getMaxCompactionTaskSlots() ); final int numAvailableCompactionTaskSlots = runningCompactTasks.size() > 0 ? compactionTaskCapacity - runningCompactTasks.size() : Math.max(1, compactionTaskCapacity - runningCompactTasks.size()); LOG.info("Running tasks [%d/%d]", runningCompactTasks.size(), compactionTaskCapacity); if (numAvailableCompactionTaskSlots > 0) { stats.accumulate(doRun(compactionConfigs, numAvailableCompactionTaskSlots, iterator)); } else { stats.accumulate(makeStats(0, iterator)); } } else { LOG.info("compactionConfig is empty. Skip."); } } else { LOG.info("maxCompactionTaskSlots was set to 0. Skip compaction"); } return params.buildFromExisting() .withCoordinatorStats(stats) .build(); }</code><technical_language>CompactionTask.TYPE.equals(status.getType()) remove reference literal cover for case status.getType() is null for reason</technical_language>

Target:
public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { LOG.info("Run coordinator segment compactor"); final CoordinatorDynamicConfig dynamicConfig = params.getCoordinatorDynamicConfig(); final CoordinatorStats stats = new CoordinatorStats(); if (dynamicConfig.getMaxCompactionTaskSlots() > 0) { Map<String, VersionedIntervalTimeline<String, DataSegment>> dataSources = params.getDataSources(); List<CoordinatorCompactionConfig> compactionConfigList = dynamicConfig.getCompactionConfigs(); if (compactionConfigList != null && !compactionConfigList.isEmpty()) { Map<String, CoordinatorCompactionConfig> compactionConfigs = compactionConfigList .stream() .collect(Collectors.toMap(CoordinatorCompactionConfig::getDataSource, Function.identity())); final int numRunningCompactTasks = indexingServiceClient .getRunningTasks() .stream() .filter(status -> status.getType().equals(COMPACT_TASK_TYPE)) .collect(Collectors.toList()) .size(); final CompactionSegmentIterator iterator = policy.reset(compactionConfigs, dataSources); final int compactionTaskCapacity = (int) Math.min( indexingServiceClient.getTotalWorkerCapacity() * dynamicConfig.getCompactionTaskSlotRatio(), dynamicConfig.getMaxCompactionTaskSlots() ); final int numAvailableCompactionTaskSlots = numRunningCompactTasks > 0 ? compactionTaskCapacity - numRunningCompactTasks : Math.max(1, compactionTaskCapacity); LOG.info("Running tasks [%d/%d]", numRunningCompactTasks, compactionTaskCapacity); if (numAvailableCompactionTaskSlots > 0) { stats.accumulate(doRun(compactionConfigs, numAvailableCompactionTaskSlots, iterator)); } else { stats.accumulate(makeStats(0, iterator)); } } else { LOG.info("compactionConfig is empty. Skip."); } } else { LOG.info("maxCompactionTaskSlots was set to 0. Skip compaction"); } return params.buildFromExisting() .withCoordinatorStats(stats) .build(); }