HPCC-11111 Make use of isXAlreadyLocallySorted()

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Merge pull request #5852 from jakesmith/hpcc-11111

HPCC-11111 Make use of isXAlreadyLocallySorted()

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>