//--------------------------------------------------------------------------------------- // Creates a new repartitioning enumerator. // // Arguments: // source - the data stream from which to pull elements // useOrdinalOrderPreservation - whether order preservation is required // partitionCount - total number of partitions // partitionIndex - this operator's unique partition index // repartitionStream - the stream object to use for partition selection // barrier - a latch used to signal task completion // buffers - a set of buffers for inter-task communication // internal OrderedHashRepartitionEnumerator( QueryOperatorEnumerator <TInputOutput, TOrderKey> source, int partitionCount, int partitionIndex, Func <TInputOutput, THashKey> keySelector, OrderedHashRepartitionStream <TInputOutput, THashKey, TOrderKey> repartitionStream, CountdownEvent barrier, ListChunk <Pair <TInputOutput, THashKey> >[,] valueExchangeMatrix, ListChunk <TOrderKey>[,] keyExchangeMatrix, CancellationToken cancellationToken) { Contract.Assert(source != null); Contract.Assert(keySelector != null || typeof(THashKey) == typeof(NoKeyMemoizationRequired)); Contract.Assert(repartitionStream != null); Contract.Assert(barrier != null); Contract.Assert(valueExchangeMatrix != null); Contract.Assert(valueExchangeMatrix.GetLength(0) == partitionCount, "expected square matrix of buffers (NxN)"); Contract.Assert(valueExchangeMatrix.GetLength(1) == partitionCount, "expected square matrix of buffers (NxN)"); Contract.Assert(0 <= partitionIndex && partitionIndex < partitionCount); m_source = source; m_partitionCount = partitionCount; m_partitionIndex = partitionIndex; m_keySelector = keySelector; m_repartitionStream = repartitionStream; m_barrier = barrier; m_valueExchangeMatrix = valueExchangeMatrix; m_keyExchangeMatrix = keyExchangeMatrix; m_cancellationToken = cancellationToken; }
internal OrderedHashRepartitionEnumerator(QueryOperatorEnumerator <TInputOutput, TOrderKey> source, int partitionCount, int partitionIndex, Func <TInputOutput, THashKey> keySelector, OrderedHashRepartitionStream <TInputOutput, THashKey, TOrderKey> repartitionStream, CountdownEvent barrier, ListChunk <Pair <TInputOutput, THashKey> >[,] valueExchangeMatrix, ListChunk <TOrderKey>[,] keyExchangeMatrix, CancellationToken cancellationToken) { this.m_source = source; this.m_partitionCount = partitionCount; this.m_partitionIndex = partitionIndex; this.m_keySelector = keySelector; this.m_repartitionStream = repartitionStream; this.m_barrier = barrier; this.m_valueExchangeMatrix = valueExchangeMatrix; this.m_keyExchangeMatrix = keyExchangeMatrix; this.m_cancellationToken = cancellationToken; }