HPCC-12627 Optimize BuildCtx::queryAssociation

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>