Make #distinct available at the class level.

[ fix #2719 ]