Added a parameter to grouping functions to determine whether to use permanent assigned row ids or physical row ids