Fix issue with count and avg distinct with new parser