code: protected void setNumberOfReducers(Job job) throws IOException {
  
      // get input size
      long inputSize = 0;
      for (Path inputPath : this.mapReduceInputPaths) {
        inputSize += this.fs.getContentSummary(inputPath).getLength();
      }
  
      // get target file size
      long targetFileSize =
          this.state.getPropAsLong(MRCompactorAvroKeyDedupJobRunner.COMPACTION_JOB_TARGET_OUTPUT_FILE_SIZE,
              MRCompactorAvroKeyDedupJobRunner.DEFAULT_COMPACTION_JOB_TARGET_OUTPUT_FILE_SIZE);
  
      // get max reducers
      int maxNumReducers = state.getPropAsInt(MRCompactorAvroKeyDedupJobRunner.COMPACTION_JOB_MAX_NUM_REDUCERS,
          MRCompactorAvroKeyDedupJobRunner.DEFAULT_COMPACTION_JOB_MAX_NUM_REDUCERS);
  
      int numReducers = Math.min(Ints.checkedCast(inputSize / targetFileSize) + 1, maxNumReducers);
  
      // get use prime reducers
      boolean usePrimeReducers =
          state.getPropAsBoolean(MRCompactorAvroKeyDedupJobRunner.COMPACTION_JOB_USE_PRIME_REDUCERS,
              MRCompactorAvroKeyDedupJobRunner.DEFAULT_COMPACTION_JOB_USE_PRIME_REDUCERS);
  
      if (usePrimeReducers && numReducers != 1) {
        numReducers = Primes.nextPrime(numReducers);
      }
      job.setNumReduceTasks(numReducers);
    }
docs: Refer to {@link MRCompactorAvroKeyDedupJobRunner#setNumberOfReducers(Job)}
  Note that this method is not format specific.