@Override
  public void preReadDataRanges(DiskRangeList ranges) throws IOException {
    boolean hasFileId = this.fileKey != null;
    long baseOffset = 0L;

    // 2. Now, read all of the ranges from cache or disk.
    IdentityHashMap<ByteBuffer, Boolean> toRelease = new IdentityHashMap<>();
    MutateHelper toRead = getDataFromCacheAndDisk(ranges, 0, hasFileId, toRelease);

    // 3. For uncompressed case, we need some special processing before read.
    preReadUncompressedStreams(baseOffset, toRead, toRelease);

    // 4. Decompress the data.
    ColumnStreamData csd = POOLS.csdPool.take();
    try {
      csd.incRef();
      DiskRangeList drl = toRead.next;
      while (drl != null) {
        drl = readEncodedStream(baseOffset, drl, drl.getOffset(), drl.getEnd(), csd, drl.getOffset(), drl.getEnd(),
                toRelease);
        for (MemoryBuffer buf : csd.getCacheBuffers()) {
          cacheWrapper.releaseBuffer(buf);
        }
        if (drl != null)
          drl = drl.next;
        }
    } finally {
      if (toRead != null) {
        releaseInitialRefcounts(toRead.next);
      }
      if (toRelease != null) {
        releaseBuffers(toRelease.keySet(), true);
        toRelease.clear();
      }
      if (csd != null) {
        csd.decRef();
        POOLS.csdPool.offer(csd);
      }
    }
  }
Uncompresses part of the stream. RGs can overlap, so we cannot just go and decompress
and remove what we have returned. We will keep iterator as a "hint" point.
@param baseOffset Absolute offset of boundaries and ranges relative to file, for cache keys.
@param start Ordered ranges containing file data. Helpful if they point close to cOffset.
@param cOffset Start offset to decompress.
@param endCOffset End offset to decompress; estimate, partial CBs will be ignored.
@param csd Stream data, to add the results.
@param unlockUntilCOffset The offset until which the buffers can be unlocked in cache, as
                          they will not be used in future calls (see the class comment in
                          EncodedReaderImpl about refcounts).
@return Last buffer cached during decompression. Cache buffers are never removed from
        the master list, so they are safe to keep as iterators for various streams.
ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedReaderImpl.java