risingwavelabs/risingwave · error

USING is not supported for rust function

Error message

USING is not supported for rust function

What it means

Rust UDFs are registered by source code (compiled/embedded), not by fetching a binary, so the USING clause (LINK or base64 binary) is invalid for them. `create_rust` rejects any attempt to pass USING options.

Solutions

  1. Remove the USING clause from the rust UDF CREATE FUNCTION statement
  2. If you need a binary/link-based function, register it as a WASM UDF instead (`AS wasm USING LINK ...`)
  3. Provide the rust source with AS and the return type as required for rust UDFs

Example fix

-- before
CREATE FUNCTION f(INT) RETURNS INT LANGUAGE rust AS 'fn f(x: i32) -> i32 { x }' USING LINK 'http://x/f.wasm';
-- after
CREATE FUNCTION f(INT) RETURNS INT LANGUAGE rust AS 'fn f(x: i32) -> i32 { x }';
Defensive patterns

Strategy: validation

Validate before calling

if (language === 'rust' && sql.includes('USING')) throw new Error('USING is not supported for rust function');

Try / catch

try { await rw.query(createFunctionSql) } catch (e) { if (String(e).includes('USING is not supported for rust')) { /* strip USING and retry */ } else throw e; }

Prevention

When it happens

Trigger: `CREATE FUNCTION ... AS <rust source> ... USING LINK '...'` — `create_rust` sees `opts.using_link.is_some()`.

Common situations: Copy-pasting a WASM UDF DDL template (which requires USING) for a rust UDF; mixing rust and wasm registration syntax.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/62e3c33c3eef0935. Report an issue: GitHub.

Appendix: source

Thrown at src/expr/impl/src/udf/wasm.rs:92

            // test if the function exists in the wasm binary
            _ = runtime.find_table_function(&name_in_runtime, arg_types, return_type)?;
        }
        UdfKind::Aggregate => {
            todo!("wasm udaf");
        }
    }

    let compressed_binary = Some(zstd::stream::encode_all(&*wasm_binary, 0)?);
    Ok(CreateFunctionOutput {
        name_in_runtime,
        body: None,
        compressed_binary,
    })
}

fn create_rust(opts: CreateOptions<'_>) -> Result<CreateFunctionOutput> {
    if opts.using_link.is_some() {
        bail!("USING is not supported for rust function");
    }
    let name_in_runtime = opts.name.to_owned();

    let prelude = "use arrow_udf::{{function, types::*}};";
    let export_macro = if opts
        .arg_types
        .iter()
        .chain(std::iter::once(opts.return_type))
        .all(|t| !t.is_struct())
    {
        let identifier_v1 = wasm_identifier_v1(
            &name_in_runtime,
            opts.arg_types,
            opts.return_type,
            opts.kind.is_table(),
        )?;
        format!("#[function(\"{}\")]", identifier_v1)
    } else {

View on GitHub (pinned to 6469eb736d)