Skip to content

feat(sql): add WebAssembly (WASM) scalar UDF support - #2555

Open
cocvn157 wants to merge 1 commit into
getdozer:mainfrom
cocvn157:feat-wasm-udf-1653
Open

cocvn157 wants to merge 1 commit into
getdozer:mainfrom
cocvn157:feat-wasm-udf-1653

Conversation

@cocvn157

@cocvn157 cocvn157 commented Nov 7, 2026

Copy link
Copy Markdown

Adds support for defining and executing WebAssembly (.wasm) scalar User-Defined Functions in Dozer SQL using wasmi.

Changes

  • UDF Configuration (dozer-types): Extends UdfType with Wasm(WasmConfig) and adds deserialize_udfs on Config.udfs so both the issue's shorthand mapping (udfs: { wasm: { my_function: udfs/wasm/my_function } }) and the tagged list syntax (!Wasm) deserialize cleanly into Vec. Automatically appends .wasm when the configured path omits a file extension.
  • Sandboxed WASM Runtime (dozer-sql/expression/src/wasm.rs): Loads and validates .wasm modules at pipeline startup (�alidate_udfs) with strict limits on module size, fuel budget, and linear memory. Supports numeric scalar parameters and return values (i32, i64, 32, 64), propagates SQL NULL inputs without invoking the guest, links AssemblyScript's env.abort handler, and creates an isolated store per row evaluation so mutable guest globals/memory cannot leak across streaming inserts, updates, or retractions.
  • SQL Expression & Pipeline Integration (dozer-sql): Connects UdfType::Wasm into ExpressionBuilder and Expression::WasmUdf with case-insensitive SQL function lookup and startup validation in statement_to_pipeline.
  • Example & Tests (examples/wasm-udf, dozer-types, dozer-sql): Includes an AssemblyScript example (my_function.ts / .wasm / .wat) and unit + streaming pipeline tests covering YAML deserialization, boundary checks, NULL propagation, trap recovery, and streaming Insert/Update/Delete execution.

Fixes #1653
/claim #1653

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WASM UDF support

1 participant