HPCC-10296 Optimize the nextRow() calls in thor

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

HPCC-10296 Optimize the nextRow() calls in thor

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>