public override void RetrieveResults(out ITableResults resTable, out GroupByResults groupByResults)
 {
     resTable = null;
     if (this.groupJobs.Length > 1)
     {
         groupByResults = new ConDictGroupDictKeyFullBucket(this.globalGroups, new TableResults());
     }
     else
     {
         groupByResults = new GroupByResultsList(this.groupJobs[0].groups, this.groupJobs[0].aggResults, this.groupJobs[0].resTable);
     }
 }
Esempio n. 2
0
        public override void Compute(out ITableResults resTable, out GroupByResults groupByResults)
        {
            var aggs = this.aggregates.ToArray();

            if (next != null)
            {
                this.next.Compute(out resTable, out groupByResults);
                this.next = null;
                if (resTable == null)
                {
                    throw new ArgumentNullException($"{this.GetType()}, table results are set to null.");
                }

                // If there are no results, return empty storage.
                if (resTable.NumberOfMatchedElements == 0)
                {
                    groupByResults = new GroupByResultsList(new Dictionary <GroupDictKey, int>(), null, resTable);
                }
                else
                {
                    Grouper grouper;
                    if (this.helper.IsSetSingleGroupGroupBy)
                    {
                        grouper = new SingleGroupGroupBy(aggs, null, this.helper);
                    }
                    else
                    {
                        // Use reference single thread solutions because the result table cannot be split equaly among threads.
                        // This also means that the result table is quite small.
                        if (resTable.NumberOfMatchedElements / helper.ThreadCount == 0)
                        {
                            grouper = Grouper.Factory(GrouperAlias.RefL, aggs, this.hashes, this.helper);
                        }
                        else
                        {
                            grouper = Grouper.Factory(aggs, this.hashes, this.helper);
                        }
                    }
                    groupByResults = grouper.Group(resTable);
                }
            }
            else
            {
                throw new NullReferenceException($"{this.GetType()}, next is set to null.");
            }
        }