HPCC-12408 Various code generator optimizations

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
was deliberately added to separate out the logic of processing the children from the way that the main dataset is processed.