v.23.9Performance Improvement

Optimization for COUNT(DISTINCT) and uniq variants in subqueries with GROUP BY

An optimization to rewrite COUNT(DISTINCT ...) and various uniq variants to count if it is selected from a subquery with GROUP BY. #52082 #52645 (JackyWoo).