New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust UDF error #46
Comments
Hi. That error means that the wasm module is expecting the host (the database, in this case) to provide it with an implementation of that function. SingleStore doesn't current supply any imports except what's included in WASI. A couple of questions for you:
|
Yes, I have used the dev container.
I am trying to build udf to convert lat and lon to h3index. The code I have tested with is available here https://github.com/K4Mobility/singlestore-h3index-udf |
Thank you for providing this information. I'll investigate and get back to you soon. |
In the h3ron project, I found the following comment (from https://github.com/nmandery/h3ron/blob/main/h3ron/examples/compile_to_wasi/Makefile):
Based on this, in the SingleStore development container, I set the RUSTFLAGS environment variable like this:
Then, I deleted the target directory and rebuilt:
This allowed me to successfully run the function in the database:
|
Nice. It works. Thank you very much! |
I have built a Rust UDF and added the function to Singlestore database using this command
CREATE FUNCTION <function name> AS WASM FROM HTTP 'https://<>.wasm' with WIT from HTTP 'https://<>.wit'
when I ran
select function(1,2,3) AS Result
observing this errorERROR 2654 UNKNOWN_ERR_CODE: Wasm module instantiation failed with error. unknown import:
env::__extenddftf2has not been defined
Can someone help me fix this issue?
The text was updated successfully, but these errors were encountered: