test query grouping