CostController for a TEMP-table based algorithm for computing Grouped Aggregates.
The TEMP base algorithm is separated into a parallel and sequential
phase. The parallel phase always occurs, and contributes its cost
to the local portion of the sequential phase.
Costing the Parallel Phase
For each partition in the underlying scan, we submit a parallel task which reads
all data, then pushes that data into temp sorted according to key columns. We
assume that data is uniformly distributed across the known partitions (which
is a poor assumption in many cases, but for v1.0 will work acceptably), so
we know that each task will read 1/numPartitions worth of the rows. As a result,
the parallel cost is
parallelCost = (baseCost.localCost+baseCost.remoteCost)/numPartitions
The output partition count is 1 (until we modify the Sort operation to
use multiple buffers, which we can't do unless we know it's the top operation).
Costing the Sequential Phase
The sequential phase merely reads the total data set out over the network,
so it inherits the remote cost of the previous operation.
finalLocalCost = parallelCost + baseCost.remoteCost;
Close the controller.
Close the open controller. This method always succeeds, and never
throws any exceptions. Callers must not use the StoreCostController
after closing it; they are strongly advised to clear
out the StoreCostController reference after closing.