R/PivotBatchCalculator.R
PivotBatchCalculator.Rd
The `PivotBatchCalculator` class calculates the values for multiple cells in the pivot table in one evaluation step (per batch), instead of evaluating every calculation once per pivot table cell.
R6Class
object.
Evaluating a set of filters and calculations repetitively for each cell is inefficient and slow. The Batch Calculator executes a much small number of calculations which greatly reduces the CPU time and elapsed time required. See the "Performance" vignette for details.
batchCount
The number of batches generated for the pivot table.
calculationSummary
A summary of the batch compatibility for each calculation.
batchSummary
A summary of the batches in the pivot table.
new()
Create a new `PivotBatchCalculator` object.
PivotBatchCalculator$new(parentPivot = NULL)
checkValidWorkingData()
Run some additional checks to see whether the working data is valid. Typically only used in development builds of the package.
isFiltersBatchCompatible()
Examines a set of filters to see whether they are compatible with batch evaluation mode. Only filters that specify zero or one value for each variable are compatible with batch evaluation.
It is not practical to make batch evaluation work where a filter matches more than one value for a variable. One approach might be to add a derived column where a single value represents the multiple values, however the combination of values could partially overlap with combinations of values in other data groups. Also the value that represents the "combined" value could collide with other existing values in the column. In summary: Sequential mode is slower and more flexible. Batch is faster but stricter. Batch mode works for regular pivot tables (i.e. most cases).
generateBatchesForNamedCalculationEvaluation1()
Generates a new batch or finds a relevant existing batch for a named calculation and single working filters object.
PivotBatchCalculator$generateBatchesForNamedCalculationEvaluation1(
dataName = NULL,
calculationName = NULL,
calculationGroupName = NULL,
workingFilters = NULL
)
generateBatchesForNamedCalculationEvaluation2()
Generates one or more batches for the named calculations and set of working working data associated with a cell.
PivotBatchCalculator$generateBatchesForNamedCalculationEvaluation2(
calculationName = NULL,
calculationGroupName = NULL,
workingData = NULL
)
calculationName
The name of the calculation.
calculationGroupName
The calculation group of the calculation.
workingData
A list containing filter and/or filter overrides.
getSummaryValueFromBatch()
Retrieve one calculation value from one batch, typically for the value of one cell in a pivot table.
PivotBatchCalculator$getSummaryValueFromBatch(
batchName = NULL,
calculationName = NULL,
calculationGroupName = NULL,
workingFilters = NULL
)
# This class should only be created by the pivot table.
# It is not intended to be created outside of the pivot table.