Generate AGG_SORTED rather than AGG_PLAIN if there are multiple
empty grouping sets.
Cleanup pass.