Hi all, I recently wrote some UDA and I noticed that in be/src/udf/udf.h the comments for SetFunctionState starts with > Methods for maintaining state across UDF/UDA function calls. I presume GetFunctionState/SetFunctionState should work for UDA as well.
I first tried to find an example in the repo, but I found the function is exclusively used by UDF. I then implemented a simple UDA just to test its behaviour. My current findings are: Even when using SetFunctionState(THREAD_LOCAL, some_ptr) only in the Init, other threads (presumably in the same fragment) can still see it with GetFunctionState(THREAD_LOCAL) if their Init were invoked later. Currently it seems that threads in the same fragment were calling Init sequentially without race condition on FunctionState. My questions: Are GetFunctionState/SetFunctionState well-defined in UDA? If so, what are the semantics and execution guarantees? How does passing different FunctionStateScope change the behavior? Is it guaranteed thread-safe? Thanks.