public static IEnumerator<EventBean> For( IEnumerator<EventBean> sourceIterator, ResultSetProcessorRowPerGroup resultSetProcessor, AggregationService aggregationService, ExprEvaluatorContext exprEvaluatorContext) { var eventsPerStream = new EventBean[1]; var priorSeenGroups = new HashSet<object>(); var hasHavingClause = resultSetProcessor.HasHavingClause; while (sourceIterator.MoveNext()) { eventsPerStream[0] = sourceIterator.Current; var groupKey = resultSetProcessor.GenerateGroupKeySingle(eventsPerStream, true); aggregationService.SetCurrentAccess(groupKey, exprEvaluatorContext.AgentInstanceId, null); if (hasHavingClause) { var pass = resultSetProcessor.EvaluateHavingClause(eventsPerStream, true, exprEvaluatorContext); if (!pass) { continue; } } if (priorSeenGroups.Contains(groupKey)) { continue; } priorSeenGroups.Add(groupKey); yield return resultSetProcessor.SelectExprProcessor.Process( eventsPerStream, true, true, exprEvaluatorContext); } }