Thalweg · API reference ← Main docs

Crate twg_udf

Crate twg_udf 

Source
Expand description

twg-udf: user-defined functions for Thalweg’s DataFusion transform engine.

Two families of function live here behind a single registration API:

  • Local UDFs run in-process against Arrow arrays: Spark-compatible helpers (local::spark_compat), a JSONPath extractor (local::json), an Avro decimal decoder (local::avro_decimal), and a fail-closed salted hash (local::crypto). They are always available.
  • Remote UDFs (the remote feature) call an external worker over Arrow Flight DoExchange, with a manifest-driven security envelope: mTLS or a sidecar transport, response containment checks, a per-service circuit breaker, per-call timeouts, and metrics/audit logging. See the remote module.

§Registration

register_all_udfs is the single entry point. It always registers the local UDFs and, when a manifest path is supplied and the remote feature is compiled in, the remote UDFs it describes. It returns a UdfRegistration handle that owns the live metrics registry so remote metrics survive past registration and can be exported.

use datafusion::execution::context::SessionContext;

let ctx = SessionContext::new();
let handle = twg_udf::register_all_udfs(&ctx, Some("a-strong-random-salt-value"), None::<&str>).await?;

Re-exports§

pub use local::register_local_udfs;

Modules§

local
Local UDF implementations that execute in-process against Arrow arrays.
remote
Remote UDF execution over Arrow Flight.

Structs§

UdfRegistration
Handle returned by register_all_udfs.

Enums§

UdfError
Errors surfaced by the crate’s registration entry points.

Functions§

register_all_udfs
Register all enabled UDFs with a DataFusion SessionContext.