private ProcCacheChunk addOneCompressionBlockByteBuffer(ByteBuffer fullCompressionBlock,
      boolean isUncompressed, long cbStartOffset, long cbEndOffset, int lastChunkLength,
      BufferChunk lastChunk, List<ProcCacheChunk> toDecompress, List<MemoryBuffer> cacheBuffers,
      boolean doTrace) {
    // Prepare future cache buffer.
    MemoryBuffer futureAlloc = cacheWrapper.getDataBufferFactory().create();
    // Add it to result in order we are processing.
    cacheBuffers.add(futureAlloc);
    // Add it to the list of work to decompress.
    ProcCacheChunk cc = new ProcCacheChunk(cbStartOffset, cbEndOffset, !isUncompressed,
        fullCompressionBlock, futureAlloc, cacheBuffers.size() - 1);
    toDecompress.add(cc);
    // Adjust the compression block position.
    if (isTracingEnabled) {
      LOG.trace("Adjusting " + lastChunk + " to consume " + lastChunkLength + " compressed bytes");
    }
    if (doTrace) {
      trace.logCompositeOrcCb(lastChunkLength, lastChunk.getData().remaining(), cc);
    }
    lastChunk.getData().position(lastChunk.getData().position() + lastChunkLength);
    // Finally, put it in the ranges list for future use (if shared between RGs).
    // Before anyone else accesses it, it would have been allocated and decompressed locally.
    if (lastChunk.getData().remaining() <= 0) {
      if (isTracingEnabled) {
        LOG.trace("Replacing " + lastChunk + " with " + cc + " in the buffers");
      }
      lastChunk.replaceSelfWith(cc);
    } else {
      if (isTracingEnabled) {
        LOG.trace("Adding " + cc + " before " + lastChunk + " in the buffers");
      }
      lastChunk.insertPartBefore(cc);
    }
    return cc;
  }
Add one buffer with compressed data the results for addOneCompressionBuffer (see javadoc).
@param fullCompressionBlock (fCB) Entire compression block, sliced or copied from disk data.
@param isUncompressed Whether the data in the block is uncompressed.
@param cbStartOffset Compressed start offset of the fCB.
@param cbEndOffset Compressed end offset of the fCB.
@param lastChunkLength The number of compressed bytes consumed from last *chunk* into fullCompressionBlock.
@param lastChunk
@param toDecompress See addOneCompressionBuffer.
@param cacheBuffers See addOneCompressionBuffer.
@return New cache buffer.
ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedReaderImpl.java