Eng 6485 fix bug of limit and group by

Bad change. This is a good test case to guarantee the optimized cases.