Preserve order for grouping fields.

Currently, the grouping fields in a query that uses aggregators get put into a scrambled order due to the use of set operations.  This is normally not a problem, but it can become one when you are expecting to see similar groups to be close together, e.g. when using a template tap with template fields that are coarser than the group-by fields.  In this situation, the template tap may be forced to re-open files that it has previously seen, which may cause "file already exists" errors.