Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/knut

crates/knut-bifrost/wasm-guest/README.md

knut-bifrost-wasm-guest

A real wasm32-unknown-unknown guest for the WasmTransform host in crates/knut-bifrost/src/wasm.rs. It reads the input Arrow IPC stream, keeps only the rows where _gar_id is even, and writes the result back as an Arrow IPC stream — proving arrow-on-wasm works, and giving users a template for their own polyglot, out-of-line transforms.

This crate is not a knut workspace member: it only ever builds for wasm32-unknown-unknown, so the root Cargo.toml lists it under [workspace] exclude, and the crate carries an empty [workspace] table so it resolves a separate (wasm-only) dependency tree and lockfile.

Guest ABI

The module exports (matching the host):

Build

cargo build -p knut-bifrost-wasm-guest \
    --target wasm32-unknown-unknown --release \
    --manifest-path crates/knut-bifrost/wasm-guest/Cargo.toml

(or from inside this directory: cargo build --target wasm32-unknown-unknown --release).

The wasm32-unknown-unknown target must be installed (rustup target add wasm32-unknown-unknown). The artifact lands at:

target/wasm32-unknown-unknown/release/knut_bifrost_wasm_guest.wasm

(~1.2 MB; opt-level = "z" + lto + panic = "abort").

arrow-on-wasm

Arrow 58 compiles to wasm32-unknown-unknown out of the box — no patches, no shims, no feature gymnastics. arrow-array, arrow-schema, arrow-buffer, arrow-data, arrow-ipc, arrow-select, plus their transitive deps (flatbuffers, chrono, half, ahash, getrandom 0.2, num-*) all build cleanly for the bare-unknown target. getrandom 0.2 pulls in via ahash but nothing on the IPC/filter path actually calls it at runtime, so the default (no-js, no-custom) build links fine. We pass default-features = false to the arrow crates purely to keep the artifact lean.

Test it against the host

An #[ignore]d integration test in the parent crate loads this artifact and asserts only even-_gar_id rows survive:

# 1. build the guest (above), then:
cargo test -p knut-bifrost --features wasm --test wasm_guest -- --ignored

It is #[ignore]d because it depends on the pre-built .wasm; the normal cargo test run skips it.