GitHub user raulcd added a comment to the discussion: [C++] Custom compute
functions (Arrow extensibility)
You can register a custom function on the `arrow::compute::FunctionRegistry`
following the same patters that we follow to register internal functions, with
something like:
```c++
auto registry = arrow::compute::GetFunctionRegistry();
// Define and register custom compute functions
auto func = std::make_shared<ScalarFunction>("custom_add",
Arity::Binary(),
/*doc=*/FunctionDoc::Empty());
// Add Int64 kernel
ScalarKernel kernel64;
// ExecAddInt64 function not shown for simplicity
kernel64.exec = ExecAddInt64;
kernel64.signature = KernelSignature::Make({int64(), int64()},
int64());
ARROW_RETURN_NOT_OK(func->AddKernel(kernel64));
// Add kernel implementation
ARROW_RETURN_NOT_OK(registry->AddFunction(std::move(func)));
````
If you want to leverage the use of internal provided functionality like vector
sort APIs, etcetera that's a different thing as I don't think those are exposed.
GitHub link:
https://github.com/apache/arrow/discussions/46265#discussioncomment-13127773
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]