support count(distinct(foo)) in queries.