HPCC-12627 Optimize BuildCtx::queryAssociation

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

HPCC-12627 Optimize BuildCtx::queryAssociation

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>