private static int translateFieldToInteger(FieldId fieldId, RelationId requiredOriginRelationId) { // TODO: this section should be rewritten when support is added for GROUP BY columns to reference an outer scope checkState(fieldId.getRelationId().equals(requiredOriginRelationId), "grouping arguments must all come from the same relation"); return fieldId.getFieldIndex(); }