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
/// Aggregates an input series using the given operator. The shape of the aggregation (rolling time window,
/// rolling point-count window, or group by) is selected via the `AggregationBuilder` union.
/// The operator needs to be compatible with the input series, producing a numeric output (e.g., count works for
/// any type of input series whereas SUM only works for numeric series).
#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct NumericAggregation {
#[builder(custom(type = super::AggregationBuilder, convert = Box::new))]
#[serde(rename = "input")]
input: Box<super::AggregationBuilder>,
#[builder(custom(type = super::NumericAggregationOperator, convert = Box::new))]
#[serde(rename = "operator")]
operator: Box<super::NumericAggregationOperator>,
}
impl NumericAggregation {
/// Constructs a new instance of the type.
#[inline]
pub fn new(
input: super::AggregationBuilder,
operator: super::NumericAggregationOperator,
) -> Self {
Self::builder().input(input).operator(operator).build()
}
/// The aggregation shape to apply the operator over: a rolling time window, a rolling
/// point-count window, or a group-by, selected via the `AggregationBuilder` union.
#[inline]
pub fn input(&self) -> &super::AggregationBuilder {
&*self.input
}
/// The reduction applied to each window or group (e.g. sum, mean, percentile). Must be
/// compatible with the input series, producing a numeric output: Count works on any input
/// series, whereas reductions like Sum require a numeric series.
#[inline]
pub fn operator(&self) -> &super::NumericAggregationOperator {
&*self.operator
}
}