Skip to main content

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

1/// Executes user-provided scalar UDF code over aligned inputs. The function must return one output for each
2/// aligned input row, with the return type matching the series type that contains this node.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct ScalarUdfSeries {
15    #[builder(default, list(item(type = super::Series)))]
16    #[serde(rename = "inputs", skip_serializing_if = "Vec::is_empty", default)]
17    inputs: Vec<super::Series>,
18    #[builder(custom(type = super::UdfSource, convert = Box::new))]
19    #[serde(rename = "source")]
20    source: Box<super::UdfSource>,
21}
22impl ScalarUdfSeries {
23    /// Constructs a new instance of the type.
24    #[inline]
25    pub fn new(source: super::UdfSource) -> Self {
26        Self::builder().source(source).build()
27    }
28    /// Input series passed to the UDF in argument order.
29    #[inline]
30    pub fn inputs(&self) -> &[super::Series] {
31        &*self.inputs
32    }
33    /// Language-specific source definition for the UDF.
34    #[inline]
35    pub fn source(&self) -> &super::UdfSource {
36        &*self.source
37    }
38}