HPCC-9239 Generate subsort optimizations

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Merge pull request #4405 from ghalliday/issue9239

HPCC-9239 Generate subsort optimizations

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>