Add support for `key` argument to distinct function

Adds a `key` parameter to the new distinct function in order to compare on a particular column instead of the full rows.