Beispiel #1
0
        internal override IList <IEnumerable <KeyValuePair <long, TSource> > > GetOrderedEnumerables(QueryOptions options)
        {
            ReverseList <TSource>          reversed    = new ReverseList <TSource> (source.ToListOrdered());
            OrderablePartitioner <TSource> partitioner = ParallelPartitioner.CreateForStrips(reversed, 1);

            return(WrapHelper.Wrap(partitioner.GetOrderablePartitions(options.PartitionCount)));
        }
Beispiel #2
0
        internal override IList <IEnumerable <KeyValuePair <long, T> > > GetOrderedEnumerables(QueryOptions options)
        {
            OrderablePartitioner <T> partitioner = null;

            if (customPartitioner != null)
            {
                partitioner = customPartitioner as OrderablePartitioner <T>;
                if (partitioner == null)
                {
                    throw new InvalidOperationException("The partitionner you are using doesn't support ordered partitionning");
                }
            }
            else
            {
                partitioner =
                    (options.UseStrip) ? ParallelPartitioner.CreateForStrips(source, 1) : ParallelPartitioner.CreateBest(source);
            }

            options.PartitionerSettings = Tuple.Create(partitioner.KeysOrderedAcrossPartitions,
                                                       partitioner.KeysOrderedInEachPartition,
                                                       partitioner.KeysNormalized);

            // We only support one style of partitioning at the moment.
            // Standard partitioners follow this style.
            if (options.UseStrip && (!partitioner.KeysOrderedInEachPartition || partitioner.KeysOrderedAcrossPartitions))
            {
                throw new NotImplementedException("Partitioner must have KeysOrderedInEachPartition "
                                                  + "and !KeysOrderedAcrossPartitions"
                                                  + "to be used with indexed operators");
            }

            return(WrapHelper.Wrap(partitioner.GetOrderablePartitions(options.PartitionCount)));
        }
Beispiel #3
0
        internal override IEnumerable <T> GetSequential()
        {
            if (source != null)
            {
                return(source);
            }

            return(WrapHelper.Wrap(customPartitioner.GetPartitions(1))[0]);
        }
        internal override IList <IEnumerable <KeyValuePair <long, T> > > GetOrderedEnumerables(QueryOptions options)
        {
            int       partitionCount;
            IList <T> aggregList = GetAggregatedList(out partitionCount);
            IList <T> result     = ParallelQuickSort <T> .Sort(aggregList, comparison);

            OrderablePartitioner <T> partitioner = ParallelPartitioner.CreateForStrips(result, 1);

            return(WrapHelper.Wrap(partitioner.GetOrderablePartitions(options.PartitionCount)));
        }
Beispiel #5
0
        internal override IList <IEnumerable <T> > GetEnumerables(QueryOptions options)
        {
            if (customPartitioner != null)
            {
                return(WrapHelper.Wrap(customPartitioner.GetPartitions(options.PartitionCount)));
            }

            Partitioner <T> partitioner
                = (options.UseStrip) ? ParallelPartitioner.CreateForStrips(source, 1) : ParallelPartitioner.CreateBest(source);

            return(WrapHelper.Wrap(partitioner.GetPartitions(options.PartitionCount)));
        }