List<AbstractColumn> originalSelectedColumns =
query.getSelection().getColumns();
for (int i = 0; i < originalSelectedColumns.size(); i++) {
AbstractColumn column = originalSelectedColumns.get(i);
if (query.getGroup().getColumns().contains(column)) {
completionSelection.addColumn(column);
} else { // Must be an aggregation column if doesn't appear in the grouping.
// The id here is the id generated by the data source for the column containing
// the aggregated data, e.g., max-B.
String id = column.getId();
// MIN is chosen arbitrarily, because there will be exactly one.