Fix up GROUPING's list of sortgrouprefs to indices into the
grouping expressions at an appropriate place.