Replies: 2 comments 1 reply
-
Thank you, it has been very helpful to me. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @kagamiori. While I was testing the newly developed agg function, I needed to obtain the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The simple function interface for UDAFs currently doesn't allow function-level states. Function-level states are variables hold by a UDAF instance that are typically computed once and used at every row when adding inputs to accumulators or extracting values from accumulators. With the traditional vector function interface, UDAF authors use function-level states by simply defining them as data members of the function class. On the contrary, the simple function interface doesn’t expose any data member of the function class to the author-defined accumulator logics.
Below are a few examples where function-level states are necessary and useful.
To enable function-level states, we can extend SimpleAggregateAdapter to allow the UDAF author to define a FunctionState struct in the function class and let SimpleAggregateAdapter hold an instance of FunctionState. The author then implement a
void initialize(FunctionState& state, const TypePtr& resultType, const std::vector<VectorPtr>& constantInputs)
in their function class that assign values to the FunctionState instance. This initialize() function will be called only once when the aggregation function instance is created. Finally, all methods in the author-defined accumulator type receive this FunctionState instance as a const argument.A prototype with an example can be found in #8710.
Beta Was this translation helpful? Give feedback.
All reactions