Fix UniqueCount to not emit (an always null) unique field

And fix up tests so that we don't get a planner exception