add global distinct support