1 unstable release
0.1.0 | Feb 1, 2024 |
---|
#1066 in Math
6KB
Gandiva Rust UDF
This project is a collection of UDFs written in Rust for Apache Arrow Gandiva.
How to write a new UDF
- Create a new cargo workspace, like
my_func
- Two dependencies should be added for this new workspace:
- gandiva_rust_udf_macro
- gandiva_rust_udf_shared
- If your function accepts string parameter or returns string value, you should add
libc
as dependency - Add a new function in
my_func/src/lib.rs
- import
use gandiva_rust_udf_macro::udf
- use
#[udf]
macro to annotate this function - Unit test your function
- import
- Add
my_func
as dependency inudf_core/Cargo.toml
- Register
my_func
inudf_core/src/lib.rs
- Compile
udf_core
as shared librarycargo build --release --lib --workspace
- Deploy
libudf_core
shared library to where your Gandiva application can load it
How to create a different project like this
- udf_core
[lib]
crate-type = ["cdylib"]
- each function MUST depends on
gandiva_rust_udf_shared
crate