public int getVariableSize(int batchSize) {
    int variableSize = 0;
    for (int i=0; i< variableSizeAggregators.length; ++i) {
      for(int r=0; r<distinctCount; ++r) {
         VectorAggregationBufferRow buf = distinctAggregationBuffers[r];
         variableSize += buf.getAggregationBuffer(variableSizeAggregators[i]).getVariableSize();
      }
    }
    return (variableSize * batchSize)/distinctCount;
  }
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