Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1653.
/claim #1653
This adds project-local AssemblyScript/WebAssembly scalar functions behind the optional
wasmfeature. A configuredmy_functioncan be called withSELECT my_function(a, b) FROM numbers. Configuration accepts the issue'sudfs.wasmmapping, the existing tagged list, and explicittype: wasmentries.All configured WASM exports load and validate before connector setup, including unused functions and configurations without SQL. Schema planning and execution share an immutable compiled-module snapshot. Missing or invalid modules, disallowed imports, unsupported signatures, duplicate registrations and built-in name conflicts fail explicitly. Replacing a file after loading cannot silently change a running query.
The Wasmi runtime uses bounded fuel, linear memory, tables and stack depth, permits only AssemblyScript's abort import, and creates a fresh guest instance for every non-NULL call. SQL argument types are checked, return types are inferred, narrowing conversions warn during validation, and integer overflow becomes an error. AssemblyScript Boolean inputs use 0/1; Boolean results have the binary's integer result type and can be cast in SQL.
Validation on macOS arm64 with Rust 1.79.0 and protoc 25.3:
Demo video · Test evidence and source hashes · Configuration and reproduction instructions
The 30-second demo is a clearly labeled replay of actual CLI output, with timing adjusted for readability. The evidence contains raw test results with local filesystem roots redacted.
The primitive scope follows the original maintainer review, which deferred non-primitive types. Managed strings/objects, pointers, WASI and multiple results are outside this change. Wasmi was retained for its explicit execution controls; I welcome maintainer feedback on that choice versus the historically suggested Deno reuse. Full workspace/all-feature CI, other platforms, throughput and total process resource bounds have not been verified.
Implementation and verification used OpenAI Codex assistance. This submission does not presume bounty eligibility, an award or payment.