private void releaseEcbRefCountsOnError(OrcEncodedColumnBatch ecb) {
    try {
      if (isTracingEnabled) {
        LOG.trace("Unlocking the batch not sent to consumer, on error");
      }
      // We cannot send the ecb to consumer. Discard whatever is already there.
      for (int colIx = 0; colIx < ecb.getTotalColCount(); ++colIx) {
        if (!ecb.hasData(colIx)) continue;
        ColumnStreamData[] datas = ecb.getColumnData(colIx);
        for (ColumnStreamData data : datas) {
          if (data == null || data.decRef() != 0) continue;
          for (MemoryBuffer buf : data.getCacheBuffers()) {
            if (buf == null) continue;
            cacheWrapper.releaseBuffer(buf);
          }
        }
      }
    } catch (Throwable t) {
      LOG.error("Error during the cleanup of an error; ignoring", t);
    }
  }
Estimate the RowGroup offset given the next RG offset and isLast.

@param isCompressed is the RowGroup compressed
@param isLast is this the last RowGroup
@param nextGroupOffset the offset of the next RowGroup
@param streamLength the length of the whole Stream
@param bufferSize the size of the buffer
@return
ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedReaderImpl.java