Skip to content

Commit 73dcaad

Browse files
kesmit13claude
andcommitted
Add WIT interface definition for WASM UDF components
Required by componentize-py to build function-handler components. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9aa0901 commit 73dcaad

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

wit/udf.wit

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package singlestore:udf;
2+
3+
interface function-handler {
4+
/// Initialize the handler and discover pre-imported UDF modules.
5+
/// Must be called before any other functions.
6+
initialize: func() -> result<_, string>;
7+
8+
/// Call a function by its registered name (e.g., "my_func")
9+
/// Input/output are rowdat_1 binary format
10+
call-function: func(name: string, input: list<u8>) -> result<list<u8>, string>;
11+
12+
/// Describe all registered functions as a JSON array of objects.
13+
/// Each object has: name, args [{name, dtype, sql}], returns [{name, dtype, sql}],
14+
/// args_data_format, returns_data_format, function_type, doc
15+
describe-functions: func() -> result<string, string>;
16+
17+
/// Register a function from its signature and Python source code.
18+
/// `signature` is a JSON object matching the describe-functions element schema.
19+
/// `code` is the Python source containing the @udf-decorated function.
20+
/// `replace` controls whether an existing function of the same name is overwritten.
21+
create-function: func(signature: string, code: string, replace: bool) -> result<_, string>;
22+
}
23+
24+
world external-udf {
25+
export function-handler;
26+
}

0 commit comments

Comments
 (0)