add global distinct support
Merge pull request #599 from crate/l/global-distinct

add global distinct support