Exemplo n.º 1
0
        private void BuildSingleEnumColumnDictionary(CancellationToken cancellationToken)
        {
            // Build a CountAggregator for the enum GroupBy
            CountAggregator counts = new CountAggregator();

            XArray        values        = _column.ValuesGetter()();
            Func <XArray> indicesGetter = _column.IndicesCurrentGetter();

            int count;

            while ((count = _source.Next(XTableExtensions.DefaultBatchSize, cancellationToken)) != 0)
            {
                // Aggregate each row directly on the row index (already a small zero-based value)
                XArray indices = indicesGetter();
                counts.Add(indices, values.Count);
            }

            // Once the loop is done, get the distinct values and aggregation results
            PostSortAndFilter(values, counts.Values, counts.TotalRowCount, true);
        }