private void prepareBufferedBatchForForwarding(BufferedVectorizedRowBatch bufferedBatch, Object[] partitionKey) throws HiveException {
    overflowBatch.reset();
    copyPartitionColumnToOverflow(partitionKey);

    final int size = bufferedBatch.size;
    final int bufferedColumnCount = bufferedColumnMap.length;
    for (int i = 0; i < bufferedColumnCount; i++) {
      // Copy ColumnVectors to overflowBatch. We remember buffered columns compactly in the
      // buffered VRBs without other columns or scratch columns.
      VectorizedBatchUtil.copyNonSelectedColumnVector(bufferedBatch, i, overflowBatch,
          bufferedColumnMap[i], size);
    }
    overflowBatch.size = size;
    fillGroupResults(overflowBatch, bufferedBatch.isLastGroupBatch);
  }
Returns the values of ordering columns from a given batch and given row in an Object[].
@param vectorizedRowBatch
@param rowIndexInBatch
@return
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/ptf/VectorPTFGroupBatches.java