static Optional<byte[]> getFileSplitPoint(HStoreFile file, CellComparator comparator)
    throws IOException {
    StoreFileReader reader = file.getReader();
    if (reader == null) {
      LOG.warn("Storefile " + file + " Reader is null; cannot get split point");
      return Optional.empty();
    }
    // Get first, last, and mid keys. Midkey is the key that starts block
    // in middle of hfile. Has column and timestamp. Need to return just
    // the row we want to split on as midkey.
    Optional<ExtendedCell> optionalMidKey = reader.midKey();
    if (!optionalMidKey.isPresent()) {
      return Optional.empty();
    }
    Cell midKey = optionalMidKey.get();
    Cell firstKey = reader.getFirstKey().get();
    Cell lastKey = reader.getLastKey().get();
    // if the midkey is the same as the first or last keys, we cannot (ever) split this region.
    if (
      comparator.compareRows(midKey, firstKey) == 0 || comparator.compareRows(midKey, lastKey) == 0
    ) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("cannot split {} because midkey is the same as first or last row", file);
      }
      return Optional.empty();
    }
    return Optional.of(CellUtil.cloneRow(midKey));
  }
Gets the approximate mid-point of the given file that is optimal for use in splitting it.
@param file       the store file
@param comparator Comparator used to compare KVs.
@return The split point row, or null if splitting is not possible, or reader is null.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreUtils.java