Skip to main content

get_or_init_udwf

Macro get_or_init_udwf 

Source
macro_rules! get_or_init_udwf {
    ($UDWF:ident, $OUT_FN_NAME:ident, $UDWF_FN:ident, $DOC:expr) => { ... };
    ($UDWF:ident, $OUT_FN_NAME:ident, $UDWF_FN: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 expression function name UDWF_FN : The unique function name
  • $DOC: Doc comments for UDWF.
  • (optional) $CTOR: Pass a custom constructor. When omitted it automatically resolves to $UDWF::default().

§Example

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