docs.rs failed to build arrow-udf-python-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
arrow-udf-python-0.4.2
Python UDF for Apache Arrow
Notice: Python 3.12 is required to run this library.
If python3
is not 3.12, please set the environment variable PYO3_PYTHON=python3.12
.
Add the following lines to your Cargo.toml
:
[]
= "0.1"
Create a Runtime
and define your Python functions in string form.
Note that the function name must match the one you pass to add_function
.
use ;
let mut runtime = new.unwrap;
let python_code = r#"
def gcd(a: int, b: int) -> int:
while b:
a, b = b, a % b
return a
"#;
let return_type = Int32;
let mode = ReturnNullOnNullInput;
runtime.add_function.unwrap;
You can then call the python function on a RecordBatch
:
let input: RecordBatch = ...;
let output: RecordBatch = runtime.call.unwrap;
The python code will be run in an embedded CPython 3.12 interpreter, powered by PyO3.
See the example for more details.