private DataSet _buildDataSet(InternalContext context, DataSetGroup op) {
DataSetGroupIndex index = context.lastGroupIndex;
DataSet dataSet = context.dataSet;
ColumnGroup columnGroup = op.getColumnGroup();
List<GroupFunction> groupFunctions = op.getGroupFunctions();
// Data set header.
DataSet result = DataSetFactory.newDataSet();
result.addColumn(columnGroup.getColumnId(), ColumnType.LABEL);
for (GroupFunction groupFunction : op.getGroupFunctions()) {
result.addColumn(groupFunction.getColumnId(), ColumnType.NUMBER);
}
// Add the aggregate calculations to the result.
List<DataSetIntervalIndex> intervalIdxs = index.getIntervalIndexes();