public void mapAggregationBufferSet(VectorAggregationBufferRow bufferSet, int row) {
    if (version != bufferSet.getVersion()) {
      bufferSet.setVersionAndIndex(version, distinctCount);
      distinctAggregationBuffers[distinctCount] = bufferSet;
      ++distinctCount;
    }
    aggregationBuffers[row] = bufferSet;
  }
assigns the given aggregation buffer set to a given batch row (by row number).
populates the selection vector appropriately. This is where the versioning numbers
play a role in determining if the index cached on the aggregation buffer set is stale.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorAggregationBufferBatch.java