Skip to content

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

Open
zaidrain06 wants to merge 1 commit into
getdozer:mainfrom
zaidrain06:feat/issue-1653-wasm-udf
Open

zaidrain06 wants to merge 1 commit into
getdozer:mainfrom
zaidrain06:feat/issue-1653-wasm-udf

Conversation

@zaidrain06

@zaidrain06 zaidrain06 commented Nov 2, 2026 •

Copy link
Copy Markdown

Summary

Implements WebAssembly (.wasm) User-Defined Function (UDF) support in Dozer config and the dozer-sql-expression engine (#1653).

Key Changes

  • Configuration (dozer-types/src/models/udf_config.rs & config.rs):
    • Added UdfType::Wasm(WasmConfig) supporting both tagged sequence syntax (!Wasm) and the concise udfs:\n wasm:\n my_function: udfs/wasm/my_function map syntax specified in WASM UDF support #1653 via deserialize_udfs.
    • Automatically resolves .wasm module paths with or without the .wasm file extension.
  • SQL Expression Engine (dozer-sql/expression/src/wasm_udf.rs, builder.rs, execution.rs, error.rs):
    • Added Expression::WasmUdf and ExpressionBuilder::parse_wasm_udf to validate argument counts and types against the exported WebAssembly function signature at query build time.
    • Implemented a self-contained WebAssembly 1.0 binary module parser, validator, and deterministic stack-machine evaluator supporting i32, i64, f32, and f64 signatures, locals, globals, linear memory, and structured control flow (block, loop, if/else, br, br_if, call, return, select) with SQL NULL propagation.
  • Tests:
    • Added YAML deserialization tests (wasm_udf_tagged, wasm_udf_map_in_config) in dozer-types/src/tests/udf_yaml_deserialize.rs.
    • Added SQL expression evaluation tests (test_wasm_udf_sql_evaluation_and_extensionless_path, test_wasm_udf_float_and_int_coercion) in dozer-sql/expression/src/wasm_udf.rs.

Verification

$ cargo test -p dozer-types udf
running 3 tests
test tests::udf_yaml_deserialize::standard ... ok
test tests::udf_yaml_deserialize::wasm_udf_map_in_config ... ok
test tests::udf_yaml_deserialize::wasm_udf_tagged ... ok

$ cargo test -p dozer-sql-expression --lib
running 29 tests
...
test wasm_udf::tests::test_wasm_udf_float_and_int_coercion ... ok
test wasm_udf::tests::test_wasm_udf_sql_evaluation_and_extensionless_path ... ok
test result: ok. 29 passed; 0 failed

Closes #1653
/claim #1653


Bounty Payout Details (if direct crypto transfer is preferred alongside Algora):

  • EVM Wallet (Base / Arbitrum One / Optimism / Ethereum): 0x9d66D9cf93776B5244B3C1F39C77696B80199dE2
  • Contact: bydelibozok@gmail.com

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