Пример #1
0
        public GroupPipe(
            GroupStreamable <TOuterKey, TSource, TInnerKey> stream,
            IStreamObserver <TInnerKey, TSource> observer)
            : base(stream, observer)
        {
            this.keySelector     = stream.KeySelector;
            this.keySelectorFunc = this.keySelector.Compile();
            this.keyComparer     = stream.Properties.KeyEqualityComparer.GetGetHashCodeExpr();
            this.innerHashCode   = this.keyComparer.Compile();

            this.errorMessages = stream.ErrorMessages;
            this.l1Pool        = MemoryManager.GetMemoryPool <TInnerKey, TSource>(stream.Properties.IsColumnar);
        }
Пример #2
0
        public ShuffleStreamable(
            IStreamable <TOuterKey, TSource> source,
            Expression <Func <TSource, TInnerKey> > keySelector, int totalBranchesL2,
            int shuffleId)
            : base(source.Properties.Group(keySelector))
        {
            Contract.Requires(source != null);
            Contract.Requires(keySelector != null);
            Contract.Requires(totalBranchesL2 > 0);

            Source               = source;
            KeySelector          = keySelector;
            this.totalBranchesL2 = totalBranchesL2;
            this.shuffleId       = shuffleId;
            powerOf2             = ((totalBranchesL2 & (totalBranchesL2 - 1)) == 0);

            if (totalBranchesL2 <= 1)
            {
                singleThreadedShuffler = new GroupStreamable <TOuterKey, TSource, TInnerKey>(source, keySelector);
                this.properties        = singleThreadedShuffler.Properties;
            }
        }