internal override void WrapPartitionedStream <TKey>( PartitionedStream <TInput, TKey> inputStream, IPartitionedStreamRecipient <TOutput> recipient, bool preferStriping, QuerySettings settings) { int partitionCount = inputStream.PartitionCount; // If the index is not correct, we need to reindex. PartitionedStream <TInput, int> inputStreamInt; if (_prematureMerge) { ListQueryResults <TInput> listResults = QueryOperator <TInput> .ExecuteAndCollectResults( inputStream, partitionCount, Child.OutputOrdered, preferStriping, settings); inputStreamInt = listResults.GetPartitionedStream(); } else { Debug.Assert(typeof(TKey) == typeof(int)); inputStreamInt = (PartitionedStream <TInput, int>)(object) inputStream; } // Since the index is correct, the type of the index must be int PartitionedStream <TOutput, int> outputStream = new PartitionedStream <TOutput, int>(partitionCount, Util.GetDefaultComparer <int>(), OrdinalIndexState); for (int i = 0; i < partitionCount; i++) { outputStream[i] = new IndexedSelectQueryOperatorEnumerator(inputStreamInt[i], _selector); } recipient.Receive(outputStream); }
internal override void WrapPartitionedStream <TKey>(PartitionedStream <TInput, TKey> inputStream, IPartitionedStreamRecipient <TOutput> recipient, bool preferStriping, QuerySettings settings) { PartitionedStream <TInput, int> stream; int partitionCount = inputStream.PartitionCount; if (this.m_prematureMerge) { stream = QueryOperator <TInput> .ExecuteAndCollectResults <TKey>(inputStream, partitionCount, base.Child.OutputOrdered, preferStriping, settings).GetPartitionedStream(); } else { stream = (PartitionedStream <TInput, int>)inputStream; } PartitionedStream <TOutput, int> partitionedStream = new PartitionedStream <TOutput, int>(partitionCount, Util.GetDefaultComparer <int>(), this.OrdinalIndexState); for (int i = 0; i < partitionCount; i++) { partitionedStream[i] = new IndexedSelectQueryOperatorEnumerator <TInput, TOutput>(stream[i], this.m_selector); } recipient.Receive <int>(partitionedStream); }