HPCC-9905 Fix problems with embeded functions returning datasets

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

HPCC-9905 Fix problems with embeded functions returning datasets

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Merge remote-tracking branch 'origin/candidate-4.0.2' into closedown-4.0.x

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Merge remote-tracking branch 'origin/closedown-4.0.x'

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>