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 an enum aggregation operator. Rolling aggregation builders are not
/// supported; only the group-by shape is accepted at resolution time.
/// `Min` and `Max` require a categorical input series. `Udf` also accepts a numeric input, which reaches
/// the function as `Vec<f64>`; a categorical input reaches it as `Vec<String>`.
#[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 EnumAggregation {
#[builder(custom(type = super::AggregationBuilder, convert = Box::new))]
#[serde(rename = "input")]
input: Box<super::AggregationBuilder>,
#[builder(custom(type = super::EnumAggregationOperator, convert = Box::new))]
#[serde(rename = "operator")]
operator: Box<super::EnumAggregationOperator>,
}
impl EnumAggregation {
/// Constructs a new instance of the type.
#[inline]
pub fn new(
input: super::AggregationBuilder,
operator: super::EnumAggregationOperator,
) -> Self {
Self::builder().input(input).operator(operator).build()
}
/// The aggregation shape to apply the operator over. Only the group-by shape is
/// supported; rolling builders are rejected at resolution time.
/// The Python `enum_aggregation(...)` sugar form is categorical-only. Numeric builders expose the
/// UDF-only `enum_udf(...)` and `rust_enum_udf(...)` terminals instead.
#[inline]
pub fn input(&self) -> &super::AggregationBuilder {
&*self.input
}
/// The enum reduction applied to each group (min, max, or a user-defined function).
#[inline]
pub fn operator(&self) -> &super::EnumAggregationOperator {
&*self.operator
}
}