spark sql group by count distinct