private void readPartitionFile(FileSystem fs, Configuration conf, Path path)
      throws IOException {
      @SuppressWarnings("deprecation")
      SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);
      ImmutableBytesWritable key = new ImmutableBytesWritable();
      partitions = new ArrayList<>();
      while (reader.next(key)) {
        partitions.add(new ImmutableBytesWritable(key.copyBytes()));
      }
      reader.close();

      if (!Ordering.natural().isOrdered(partitions)) {
        throw new IOException("Partitions are not ordered!");
      }
    }
Choose partitions between row ranges to hash to a single output file Selects region
boundaries that fall within the scan range, and groups them into the desired number of
partitions.
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/HashTable.java