public int Compare(MemoryQueryResultRow x, MemoryQueryResultRow y) { if (!selectCommandContext.GetOrderByContext().GetItems().IsEmpty()) { return(Compare(x, y, selectCommandContext.GetOrderByContext().GetItems())); } return(Compare(x, y, selectCommandContext.GetGroupByContext().GetItems())); }
private void SetGroupByForDistinctRow(SelectCommandContext selectCommandContext) { for (int index = 0; index < selectCommandContext.GetProjectionsContext().GetExpandProjections().Count; index++) { OrderByItem orderByItem = new OrderByItem(new IndexOrderByItemSegment(-1, -1, index, OrderDirectionEnum.ASC, OrderDirectionEnum.ASC)); orderByItem.SetIndex(index); selectCommandContext.GetGroupByContext().GetItems().Add(orderByItem); } }
private bool IsMaxRowCount(SelectCommandContext shardingCommand) { return((shardingCommand.GetGroupByContext().GetItems().Any() || shardingCommand.GetProjectionsContext().GetAggregationProjections().Any()) && !shardingCommand.IsSameGroupByAndOrderByItems()); }
private bool IsNeedProcessGroupBy(SelectCommandContext selectCommandContext) { return(!selectCommandContext.GetGroupByContext().GetItems().IsEmpty() || !selectCommandContext.GetProjectionsContext().GetAggregationProjections().IsEmpty()); }
public override bool Read() { _currentRow.Clear(); if (OrderByValuesQueue.IsEmpty()) { return(false); } if (IsFirstNext) { base.Read(); } if (AggregateCurrentGroupByRowAndNext()) { _currentGroupByValues = new GroupByValue(GetCurrentStreamDataReader(), _selectCommandContext.GetGroupByContext().GetItems()).GetGroupValues(); } return(true); }
public GroupByStreamMergedDataReader(IDictionary <string, int> labelAndIndexMap, List <IStreamDataReader> streamDataReaders, SelectCommandContext selectCommandContext, SchemaMetaData schemaMetaData) : base(streamDataReaders, selectCommandContext, schemaMetaData) { this._selectCommandContext = selectCommandContext; _currentRow = new List <object>(labelAndIndexMap.Count); _currentGroupByValues = OrderByValuesQueue.IsEmpty() ? new List <object>(0) : new GroupByValue(GetCurrentStreamDataReader(), selectCommandContext.GetGroupByContext().GetItems()).GetGroupValues(); }