AST rewrite for COUNT DISTINCTs.
Unit tests for COUNT DISTINCT AST rewrite.