class DynamicInputFormat extends InputFormat<K, V> {

  static int getSplitRatio(int nMaps, int nRecords) {
    if (nMaps == 1) {
      LOG.warn("nMaps == 1. Why use DynamicInputFormat?");
      return 1;
    }

    if (nMaps > MAX_CHUNKS_IDEAL)
      return SPLIT_RATIO_DEFAULT;

    int nPickups = (int)Math.ceil((float)MAX_CHUNKS_IDEAL/nMaps);
    int nRecordsPerChunk = (int)Math.ceil((float)nRecords/(nMaps*nPickups));

    return nRecordsPerChunk < MIN_RECORDS_PER_CHUNK ?
              SPLIT_RATIO_DEFAULT : nPickups;
  }

}