private void validateAndUpdatePosition(int len, long sizeRead) {
      if (sizeRead != len) {
        throw new AssertionError("Reading at " + position + " for " + len + ": "
            + sizeRead + " bytes copied");
      }
      position += len;
    }
This is currently only used by Parquet; however, a generally applicable approach is used -
you pass in a set of offset pairs for a file, and the file is cached with these boundaries.
Don't add anything format specific here.
ql/src/java/org/apache/hadoop/hive/llap/LlapCacheAwareFs.java