Defining a UDAF
UDAFs are defined as functions that take some number ofVec<T> as an
argument, where T is any valid SQL data type. Note
that all arguments must be Vec—you can’t mix-and-match vector and scalar
parameters.
Example
Here’s a simple UDAF for calculating the median of a set of integers:Nullability
If a UDAF argument type is anOption (e.g., Vec<Option<i64>>), the UDAF will
be invoked with all inputs, including NULLs. Otherwise, only non-null
arguments will be passed down to the UDAF. Unlike UDFs, UDAFs will always be
invoked, although possibly with empty input vectors.