rewritten the group buffer to first collect all the rows of one group and only then transform them