ghalliday/HPCC-Platform — comment on commit 8929e47d77ba3014e93de8c4bacd443361fa50a3
File: ecl/hqlcpp/hqlhtcpp.cpp line 6125
By ghalliday:

It isn't caught because this conversion is very late on just as the code is being generated. The optimizer that removes them won't be called..

The reason the conversion is very late on is that it is much easier to optimize sort(shuffle)->sort than sort(group(sort(group)))) (and other more significant optimizations) since grouping adds lots of complications.