TwoStepMultipleColumnsHandler

internal class TwoStepMultipleColumnsHandler<in Value : Any, Return>(stepTwoAggregationHandler: AggregatorAggregationHandler<Return & Any, Return>? = null, stepTwoInputHandler: AggregatorInputHandler<Return & Any, Return>? = null) : AggregatorMultipleColumnsHandler<Value, Return>

Implementation of AggregatorMultipleColumnsHandler that aggregates the data in two steps:

  • first, it aggregates the data for each of the given columns

  • then, it aggregates the results of the first step into a single value

For the first step, this aggregator will be used as usual.

For the second step, a new Aggregator will be constructed using the supplied handlers: stepTwoAggregationHandler and stepTwoInputHandler. For both arguments, it holds that if they are not supplied or null, the handlers of this aggregator will be cast and reused. In all cases NoMultipleColumnsHandler will be used as AggregatorMultipleColumnsHandler.

This is useful for aggregators that do not depend on the distribution of values across multiple columns. It may be more memory efficient than FlatteningMultipleColumnsHandler and could be parallelized in the future.

Parameters

stepTwoAggregationHandler

The aggregation handler for the second step. If not supplied, the handler of the first step is reused.

stepTwoInputHandler

The input handler for the second step. If not supplied, the handler of the first step is reused.

See also

Constructors

Link copied to clipboard
constructor(stepTwoAggregationHandler: AggregatorAggregationHandler<Return & Any, Return>? = null, stepTwoInputHandler: AggregatorInputHandler<Return & Any, Return>? = null)

Properties

Link copied to clipboard
open override var aggregator: Aggregator<Value, Return>?

Reference to the aggregator instance.

Link copied to clipboard

The second step Aggregator which can take multiple outputs of this aggregator and aggregate it to a single value.

Functions

Link copied to clipboard
open override fun aggregateMultipleColumns(columns: Sequence<DataColumn<Value?>>): Return

Aggregates the data in the multiple given columns and computes a single resulting value.

Link copied to clipboard
open override fun calculateReturnTypeMultipleColumns(colTypes: Set<KType>, colsEmpty: Boolean): KType

Function that can give the return type of aggregateMultipleColumns, given types of the columns. This allows aggregators to avoid runtime type calculations.

Link copied to clipboard
open fun init(aggregator: Aggregator<Value, Return>)