Issue #1058754 by Yaron Tal, kathyh, naxoc, xjm: Fixed attempt to loop through undefined result set in aggregator.