Eng 6436 distinct reroute

This is the fast, simple but not the best efficient solution for DISTINCT with GROUP BY cases. We will create tickets to optimize it later.
I do not remove it because I think it will be useful in the new order of plan node tree structure. Anyway, I will remove it completely because I can get this code back from the GIT history.