SelectingAggregationHandler

internal class SelectingAggregationHandler<in Value : Return & Any, out Return>(val selector: Selector<Value, Return>, val indexOfResult: IndexOfResult<Value>, val getReturnType: CalculateReturnType) : AggregatorAggregationHandler<Value, Return>

Implementation of AggregatorAggregationHandler which functions like a selector: it takes a sequence of values and returns a single value, which must exist in the input.

This is reflected in the type constraints.

Parameters

selector

This function actually does the selection. Before it is called, nulls are filtered out. The type of the values is passed as KType to the selector.

indexOfResult

This function must be supplied to give the index of the result in the input values.

getReturnType

This function must be supplied to give the return type of selector given some input type and whether the input is empty. In practice the return type is always either typeOf<Value>() or typeOf<Value?>().

See also

Constructors

Link copied to clipboard
constructor(selector: Selector<Value, Return>, indexOfResult: IndexOfResult<Value>, getReturnType: CalculateReturnType)

Properties

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

Reference to the aggregator instance.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun aggregateSequence(values: Sequence<Value?>, valueType: ValueType): Return

Base function of Aggregator.

Link copied to clipboard

Aggregates the data in the given column and computes a single resulting value. Calls aggregateSequence. It tries to exploit a cache for statistics which can be accessed by ValueColumnInternal

Link copied to clipboard
open override fun calculateReturnType(valueType: KType, emptyInput: Boolean): KType

Give the return type of selector given some input type and whether the input is empty. Calls the supplied getReturnType.

Link copied to clipboard
open override fun indexOfAggregationResultSingleSequence(values: Sequence<Value?>, valueType: ValueType): Int

Function that can give the index of the aggregation result in the input values. Calls the supplied indexOfResult after preprocessing the input.

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