You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/21 13:31:46 UTC

[GitHub] [arrow] wesm commented on a diff in pull request #13397: ARROW-16444: [R] Implement user-defined scalar functions in R bindings

wesm commented on code in PR #13397:
URL: https://github.com/apache/arrow/pull/13397#discussion_r902624010


##########
r/src/compute.cpp:
##########
@@ -574,3 +576,118 @@ SEXP compute__CallFunction(std::string func_name, cpp11::list args, cpp11::list
 std::vector<std::string> compute__GetFunctionNames() {
   return arrow::compute::GetFunctionRegistry()->GetFunctionNames();
 }
+
+class RScalarUDFCallable : public arrow::compute::ArrayKernelExec {

Review Comment:
   Please do this a different way (e.g. put the data that you need to persist in a KernelState instead). `ArrayKernelExec` is a `std::function` and is meant to have the semantics of a function pointer, not a generic callable. I actually plan to make `ArrayKernelExec` a function pointer because debugging with `std::function` adds ~4 levels to the call stack when using gdb which is very tedious



##########
r/src/compute.cpp:
##########
@@ -574,3 +576,118 @@ SEXP compute__CallFunction(std::string func_name, cpp11::list args, cpp11::list
 std::vector<std::string> compute__GetFunctionNames() {
   return arrow::compute::GetFunctionRegistry()->GetFunctionNames();
 }
+
+class RScalarUDFCallable : public arrow::compute::ArrayKernelExec {

Review Comment:
   Please do this a different way (e.g. put the data that you need to persist in a KernelState instead). `ArrayKernelExec` is a `std::function` and is meant to have the semantics of a function pointer, not a generic callable class. I actually plan to make `ArrayKernelExec` a function pointer because debugging with `std::function` adds ~4 levels to the call stack when using gdb which is very tedious



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org