CONTRIB-5025: Respect grouping restrictions