Add WASM UDF support#2500
Conversation
|
/claim #1653 |
|
Demo / verification evidence for the WASM UDF path:
Local validation commands used: C:\Users\Administrator\.cargo\bin\cargo.exe fmt -p dozer-types -p dozer-sql-expression -p dozer-sql
$env:PROTOC='D:\coin\protoc-35.0-win64\bin\protoc.exe'; C:\Users\Administrator\.cargo\bin\cargo.exe test -p dozer-sql-expression --features wasm wasm
$env:PROTOC='D:\coin\protoc-35.0-win64\bin\protoc.exe'; C:\Users\Administrator\.cargo\bin\cargo.exe test -p dozer-types udf_yaml_deserialize
$env:PROTOC='D:\coin\protoc-35.0-win64\bin\protoc.exe'; C:\Users\Administrator\.cargo\bin\cargo.exe test -p dozer-sql-expression wasm_builder_testsResults:
I can add a short video walkthrough as a follow-up if maintainers want the bounty demo requirement satisfied with an actual recording rather than the reproducible test/demo path above. |
|
Follow-up pushed in Validation rerun after the follow-up:
|
Typo, maybe |
|
Thanks for catching that. I changed the summary wording to say "initial WebAssembly UDF support", which is more accurate for this intentionally scoped first implementation. |
/claim #1653
Summary
This PR adds initial WebAssembly UDF support to Dozer SQL.
It introduces a new
!WasmUDF config variant:The configured UDF can then be called from SQL:
The exported function name defaults to the configured UDF
name. It can be overridden withfunction:Supported ABI in this first pass
intanduintmap to WASMi64floatmaps to WASMf64booleanmaps to WASMi32uintarguments outside the currenti64ABI range and negativei64returns foruintUDFs are rejected instead of silently wrappingNot included yet
These are intentionally left out to keep the first implementation small and reviewable. The scalar ABI covers the core issue path of configuring a WASM module and invoking an exported function from SQL.
Tests
Validated locally with:
Latest rerun results:
6 passed,0 failed3 passed,0 failed1 passed,0 faileddozer-sql-expression --features wasm:33 passed,0 failedcargo check -p dozer-cli --features wasmwas attempted locally, but the Windows GNU environment is missinggcc.exe, which is required by the existingringdependency during CLI compilation.Dependency Notes
This adds
wasmias the optional WASM runtime dependency andwatas a dev-dependency for generating tiny test modules from WAT.The local Cargo version is
cargo 1.96.0, which rewroteCargo.lockto version 4 and refreshed some compatible transitive dependency versions while adding the WASM-related packages. If maintainers prefer a smaller lockfile diff, regenerate the lockfile with the project's expected Cargo version before merging.