support aggregate functions with group by