private void WrapPartitionedStreamHelper <TLeftKey, TRightKey, TOutputKey>(
            PartitionedStream <Pair <TLeftInput, TKey>, TLeftKey> leftHashStream,
            HashLookupBuilder <IEnumerable <TRightInput>, TRightKey, TKey>[] rightLookupBuilders,
            HashJoinOutputKeyBuilder <TLeftKey, TRightKey, TOutputKey> outputKeyBuilder, IComparer <TOutputKey> outputKeyComparer,
            IPartitionedStreamRecipient <TOutput> outputRecipient, int partitionCount, CancellationToken cancellationToken)
        {
            PartitionedStream <TOutput, TOutputKey> outputStream = new PartitionedStream <TOutput, TOutputKey>(
                partitionCount, outputKeyComparer, OrdinalIndexState);

            for (int i = 0; i < partitionCount; i++)
            {
                outputStream[i] = new HashJoinQueryOperatorEnumerator <TLeftInput, TLeftKey, IEnumerable <TRightInput>, TRightKey, TKey, TOutput, TOutputKey>(
                    leftHashStream[i], rightLookupBuilders[i], _resultSelector, outputKeyBuilder, cancellationToken);
            }

            outputRecipient.Receive(outputStream);
        }
Beispiel #2
0
        //---------------------------------------------------------------------------------------
        // Instantiates a new hash-join enumerator.
        //

        internal HashJoinQueryOperatorEnumerator(
            QueryOperatorEnumerator <Pair <TLeftInput, THashKey>, TLeftKey> leftSource,
            HashLookupBuilder <TRightInput, TRightKey, THashKey> rightLookupBuilder,
            Func <TLeftInput, TRightInput, TOutput> resultSelector,
            HashJoinOutputKeyBuilder <TLeftKey, TRightKey, TOutputKey> outputKeyBuilder,
            CancellationToken cancellationToken)
        {
            Debug.Assert(leftSource != null);
            Debug.Assert(rightLookupBuilder != null);
            Debug.Assert(resultSelector != null);
            Debug.Assert(outputKeyBuilder != null);

            _leftSource         = leftSource;
            _rightLookupBuilder = rightLookupBuilder;
            _resultSelector     = resultSelector;
            _outputKeyBuilder   = outputKeyBuilder;
            _cancellationToken  = cancellationToken;
        }