HPCC-9239 Generate subsort optimizations

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>