datafusion_functions_window

Macro get_or_init_udwf

Source
macro_rules! get_or_init_udwf {
    ($UDWF:ident, $OUT_FN_NAME:ident, $DOC:expr) => { ... };
    ($UDWF:ident, $OUT_FN_NAME:ident, $DOC:expr, $CTOR:path) => { ... };
}
Expand description

Lazily initializes a user-defined window function exactly once when called concurrently. Repeated calls return a reference to the same instance.

§Parameters

  • $UDWF: The struct which defines the Signature of the user-defined window function.
  • $OUT_FN_NAME: The basename to generate a unique function name like $OUT_FN_NAME_udwf.
  • $DOC: Doc comments for UDWF.
  • (optional) $CTOR: Pass a custom constructor. When omitted it automatically resolves to $UDWF::default().

§Example

/// Defines the `simple_udwf()` user-defined window function.
get_or_init_udwf!(
    SimpleUDWF,
    simple,
    "Simple user-defined window function doc comment."
);