The client-side aggregator will need to sum all the counts from the serialized server-sider aggregator maps. If you add to your test a case where a distinct value occurs on more than one region server, I think it would fail now. See below in the aggregate method for what I believe needs to change.

Also, I think we'll be better off using a HashMap<ImmutableBytesPtr,Integer>. The ImmutableBytesPtr is a Phoenix class that's derived from ImmutableBytesWritable, but caches the hash code so that it can be used as the key in maps efficiently. We can give it a default size for now, but once we have stats in place, we can likely do a better job of sizing it initially.