make grouping column an agg

fixes #5610