-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Wasm-based UDF feature request and discussion #4060
Comments
How do you think about LLVM backend instead of WASM? |
Nice idea! I don't know LLVM, but just now I have checked some documentation and lesson to understand it 😂. |
Not, it's just my mind. The plan of our team is still ongoing. |
I think there are many ways to extend UDF here, nothing more than extending the connection to the code itself, like DLL, or putting in a new VM, like Wasm` or V8. probably a lot of the work is in the middle glue layer. There is also the development cost for the user to consider. |
Yes, on the other hand, supporting multiple configurable UDF backends is also a good choice if valuable. In this case, LLVM or WASM is not a problem. |
Is your feature request related to a problem? Please describe.
After seeing some issues #3946 in the community about UDF, I tried to submit a Wasm-based UDF system. I submitted an RFC during the Nebula Hackathon 2021, which is some initial thoughts. This #3566 is the initial code.
I think Wasm-based UDF is a more radical route and needs more guidance and advice.
Describe the solution you'd like
The overall module design is as follows.
Compilation Toolchain: The compiler toolchain is provided for user use and contains a series of initial templates. Users must embed their own code into the initial templates
Parsing: Create functions based on Flex and Bison implementations, and delete SQL statements for functions. The implementation syntax is in the figure below. We consider the two mainstream formats of WebAssembly text format (wat) and Wasm binary files. And its loading methods have two types. The first one is wat base64 encoding and Wasm binary file base64 encoding, which is convenient for direct input in the terminal, the program with the running size at the KB level can be directly imported. The second is the MB level Wasm Program binary files, which support importing by HTTP address and by local file address.
Function Management: Responsible for unified management of Wasm virtual machines, providing dynamic update, loading, and unloading of functions. It can also be said to be the glue for Nebula's other systems and the Wasm extension components.
Runtime: Here we introduce the C++ SDK of Wasm virtual machine,like Wasmtime, and WasmEdge. Calling SDK to compile wat code, compile and execute Wasm binary file, manage sandbox instances and WASI features, etc.
The project will face some known difficulties
Describe alternatives you've considered
Additional context
Does the official team have some initial thoughts on the UDF system design. If the official thinks the Wasm-based UDF system is in line with the project's future plans, I can do this PR.
The text was updated successfully, but these errors were encountered: