Using WASM Binaries instead of WAT

I’m attempting to embed the Parquet crate as a UDF so that I can query the metadata for a blob without taking the network hit of sending the whole thing over the wire. It’s probably not a common scenario, but I wanted to push the limits of UDFs to see how far I got.

The current implementation of UDFs is pretty neat for using Wasmtime. However, I’m running into some sizing issues after optimizing my binary size. My WASM binary is 644KB and my WAT file is 19MB. The WAT loader does not like such a big bundle and it sits at 100% CPU for hours until I eventually kill it.

Since the current issue is with loading, would it be possible to allow loading the WASM binary instead of the WAT file? As far as I can tell, the only way to load a UDF is through a CQL query embedding the WAT directly as a string.

ScyllaDB requires WebAssembly UDFs to be provided in the WebAssembly Text (WAT) format, which must be embedded directly as a string in the CQL CREATE FUNCTION statement. While you can write the WAT by hand, typically you compile your code to a Wasm binary and then convert it to WAT using a tool like wasm2wat. Currently, loading Wasm binaries directly into ScyllaDB UDFs is not supported, so you need to provide the full WAT text even if it’s large. This is the recommended and only supported method as of the latest ScyllaDB versions.

Here’s a link for the WASM relevant official documentation -

1 Like