private void InitForFirstGroupByValue(SelectCommandContext selectCommandContext, IStreamDataReader streamDataReader, GroupByValue groupByValue, IDictionary <GroupByValue, MemoryQueryResultRow> dataMap, IDictionary <GroupByValue, IDictionary <AggregationProjection, IAggregationUnit> > aggregationMap) { if (!dataMap.ContainsKey(groupByValue)) { dataMap.Add(groupByValue, new MemoryQueryResultRow(streamDataReader)); } if (!aggregationMap.ContainsKey(groupByValue)) { var map = selectCommandContext.GetProjectionsContext().GetAggregationProjections().ToDictionary(o => o, o => AggregationUnitFactory.Create(o.GetAggregationType(), o is AggregationDistinctProjection)); aggregationMap.Add(groupByValue, map); } }
private bool AggregateCurrentGroupByRowAndNext() { bool result = false; IDictionary <AggregationProjection, IAggregationUnit> aggregationUnitMap = _selectCommandContext.GetProjectionsContext().GetAggregationProjections().ToDictionary(o => o, o => AggregationUnitFactory.Create(o.GetAggregationType(), o is AggregationDistinctProjection)); while (_currentGroupByValues.SequenceEqual(new GroupByValue(GetCurrentStreamDataReader(), _selectCommandContext.GetGroupByContext().GetItems()).GetGroupValues())) { Aggregate(aggregationUnitMap); CacheCurrentRow(); result = base.Read(); if (!result) { break; } } SetAggregationValueToCurrentRow(aggregationUnitMap); return(result); }