diff --git a/pkg/query/columnquery.go b/pkg/query/columnquery.go index 18855925d00..2a1d5e82060 100644 --- a/pkg/query/columnquery.go +++ b/pkg/query/columnquery.go @@ -248,9 +248,11 @@ func (q *ColumnQueryAPI) Query(ctx context.Context, req *pb.QueryRequest) (*pb.Q groupByLabels = append(groupByLabels, f) continue } - if _, allowed := allowedGroupBy[f]; !allowed { - return nil, status.Errorf(codes.InvalidArgument, "invalid group by field: %s", f) + if _, allowed := allowedGroupBy[f]; allowed { + groupByLabels = append(groupByLabels, f) + continue } + return nil, status.Errorf(codes.InvalidArgument, "invalid group by field: %s", f) } switch req.Mode {