1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors
//! Pluggable aggregate function kernels used to provide encoding-specific implementations of
//! aggregate functions.
use Debug;
use VortexResult;
use crateArrayRef;
use crateExecutionCtx;
use crateAggregateFnRef;
use crateGroupedArray;
use crateScalar;
/// A pluggable kernel for an aggregate function.
///
/// The provided array should be aggregated into a single scalar representing the partial state
/// of a single group.
/// A pluggable kernel for batch aggregation of many groups.
///
/// A kernel can be registered either for an aggregate function regardless of the element encoding,
/// or for a specific aggregate function and element encoding. Element-encoding kernels are matched
/// on the inner array of the provided grouped array, not on the outer list encoding. This is more
/// pragmatic than having every kernel match on the outer list encoding and having to deal with the
/// possibility of multiple list encodings.
///
/// Each value in the grouped array represents a group and the result of the grouped aggregate
/// should be an array of the same length, where each element is the aggregate state of the
/// corresponding group.
///
/// Return `Ok(None)` if the kernel cannot be applied to the given aggregate function.