public void fillGroupResultsAndForward(VectorPTFOperator vecPTFOperator, Object[] partitionKey)
      throws HiveException {
    /*
     * Original logic assumes that the forwarding order is:
     * 1) forwardSpilledBatches,
     * 2) forwardBufferedBatch, so in order to preserve ordering of forwarded batches we point
     * in-memory batches to the last block.
     */
    jumpToLastBlock();
    BufferedVectorizedRowBatch lastBatch = bufferedBatches.get(currentBufferedBatchCount - 1);
    forwardSpilledBatches(vecPTFOperator, partitionKey);

    if (currentBufferedBatchCount > 0) {
      /*
       * currentBufferedBatchCount - 1: don't forward last batch here, it is forwarded in
       * forwardLastBatch
       */
      for (int i = 0; i < currentBufferedBatchCount - 1; i++) {
        forwardBufferedBatch(vecPTFOperator, bufferedBatches.get(i), partitionKey);
      }
      currentBufferedBatchCount = 0;
    }

    forwardLastBatch(vecPTFOperator, lastBatch, partitionKey);
  }
Buffers a batch at the end of bufferedBatches, and if it's full, spills a block of batches to
the disk.

@param batch
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/ptf/VectorPTFGroupBatches.java