streamling-udf-plugin
Installation
SKILL.md
streamling UDF plugin — Agent Skill
A UDF (user-defined function) is a DataFusion scalar function your plugin exposes, so pipeline SQL can call it: SELECT truncate(body, 280) FROM stream. It is the lightest way to add a derived column — no batch pipeline of your own, no process_batch. DataFusion calls your function inside its plan.
Prerequisites: streamling-plugin-basics (crate setup, registration). To use the UDF once registered, see sql-transform.
API version: these skills target DataFusion 49 / Arrow 55 (the invoke_with_args + ScalarFunctionArgs era). If your Cargo.toml pins an older DataFusion, the method may be invoke(&self, args: Vec<ColumnarValue>) instead — adapt accordingly.
Two ways to author a UDF
| Form | Register with | When |
|---|---|---|
struct MyFunc impl ScalarUDFImpl (+ Default) |
register_plugin_udf!(MyFunc) |
Default — type-safe, structured, the modern recommendation |
closure via create_udf(..) returning a ScalarUDF |
register_plugin_udf_fn!(create_my_func) |
Legacy / quick — a fn() -> ScalarUDF factory |
Both live alongside any source/sink/transform/preprocessor in the same cdylib.