Skip to main content

nominal_api/conjure/objects/scout/compute/api/
aggregate_under_ranges_series.rs

1/// Aggregates the input series under the ranges in the provided ranges series, and outputs a new series with one
2/// point at the start of each range, where the value is the aggregation result. If a range has no points, no
3/// point will be produced for it. If a range has no start, the point produced for it will be at the
4/// start of the compute request range.
5#[derive(
6    Debug,
7    Clone,
8    conjure_object::serde::Serialize,
9    conjure_object::serde::Deserialize,
10    conjure_object::private::DeriveWith
11)]
12#[serde(crate = "conjure_object::serde")]
13#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
14#[conjure_object::private::staged_builder::staged_builder]
15#[builder(crate = conjure_object::private::staged_builder, update, inline)]
16pub struct AggregateUnderRangesSeries {
17    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
18    #[serde(rename = "input")]
19    input: Box<super::NumericSeries>,
20    #[builder(custom(type = super::RangeSeries, convert = Box::new))]
21    #[serde(rename = "ranges")]
22    ranges: Box<super::RangeSeries>,
23    #[serde(rename = "operation")]
24    operation: super::NumericAggregationFunction,
25}
26impl AggregateUnderRangesSeries {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(
30        input: super::NumericSeries,
31        ranges: super::RangeSeries,
32        operation: super::NumericAggregationFunction,
33    ) -> Self {
34        Self::builder().input(input).ranges(ranges).operation(operation).build()
35    }
36    #[inline]
37    pub fn input(&self) -> &super::NumericSeries {
38        &*self.input
39    }
40    #[inline]
41    pub fn ranges(&self) -> &super::RangeSeries {
42        &*self.ranges
43    }
44    #[deprecated(
45        note = "Use a dedicated group-by-and-aggregate node instead (coming in a follow-up PR). This field is retained\nas required for backwards compatibility with existing callers.\n"
46    )]
47    #[inline]
48    pub fn operation(&self) -> &super::NumericAggregationFunction {
49        &self.operation
50    }
51}