public void compileAggregationBatchInfo(VectorAggregateExpression[] aggregators) {
    JavaDataModel model = JavaDataModel.get();
    int[] variableSizeAggregators = new int[aggregators.length];
    int indexVariableSizes = 0;

    aggregatorsFixedSize = JavaDataModel.alignUp(
        model.object() +
        model.primitive1()*2 +
        model.ref(),
        model.memoryAlign());

    aggregatorsFixedSize += model.lengthForObjectArrayOfSize(aggregators.length);
    for(int i=0;i<aggregators.length;++i) {
      VectorAggregateExpression aggregator = aggregators[i];
      aggregatorsFixedSize += aggregator.getAggregationBufferFixedSize();
      if (aggregator.hasVariableSize()) {
        variableSizeAggregators[indexVariableSizes] = i;
        ++indexVariableSizes;
      }
    }
    this.variableSizeAggregators = Arrays.copyOfRange(
        variableSizeAggregators, 0, indexVariableSizes);
  }
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