add the unit testing for Distinct, GroupBy, Join and fix some issues