Conversation
|
@vdimir just curious, how much effort is to add WASI support? Probably not in this PR, but as follow up? |
5ee9f5e to
5c8a6f8
Compare
@bacek I did a bit of research on this earlier. Overall, it looks feasible and actually like a good thing to have, since it would allow us to use more tools/compilers for wasm UDFs, treating them more like regular programs. From what I saw, wasmtime already provides some stub implementations. So in general, we would just need to decide which parts should have real implementations and which should remain restricted (e.g., we could implement guest–host interaction via stdin/stdout similar to executable UDFs, but forbid writing to arbitrary files). That said, my research was done quite a while ago and was focused on WASI Preview 1, which is essentially a set of syscall-like functions. Now WASI Preview 2 introduces the component model, and I haven’t looked into it yet. My assumption is that it’s still about implementing a set of host-side functions with specific names and signatures, but I’d need to verify that. So for now, I’d consider it a “good to have” rather than something urgent. |
4bdf4f3 to
378e821
Compare
|
Is there any plans to implement User defined aggregation function? |
It would definitely be a great feature to have, but there’s currently no roadmap or timeline for it. It might even be more useful than regular UDFs, however, it also requires more design work. At the moment, ClickHouse does not support aggregate UDFs (the existing executable UDFs are aslo limited to regular functions). On the guest side, it would probably require implementing a set of methods (e.g., |
BTW, I added wasi preview1 (I needed it for my pet project with libgeos wiring, because it pulls About 10 lines of code + run |
I also hacked There is an Imports in my module for reference: |
|
@bacek this looks promising. How does it work in general? What does the It seems that when you use How does your module handle files? Does it actually perform read/write operations on files or stdin/stdout (in which case the implementation should provide some kind of virtualized filesystem), or does it only rely on imports, meaning a no-op implementation would also work? By the way, if it’s more convenient, feel free to reach out to me on telegram https://t.me/vdimir |
Technically it is independent implementation based on
Definitely not. It's just direct copy from https://github.com/bytecodealliance/wasmtime/blob/main/examples/wasip1/main.cc
I have no idea. It doesn't work from my c++ sample at all. Actual library I'm using is not FS dependent, but somehow clang manages to put |
Actually, I've got it working. TL;DR: it's pretty rudimentary support for FS. I'm pretty sure even it's not even VFS with directories and stuff. CH change is this: Rust code is this: Directory content: this is run inside CH after scuffolding: after run: Basically after cleaning up and deciding on stdin/stdout/stderr/env handling, providing configuration for an optional "preopen_dir" it should be reasonably straight forward to implement something landable. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Close #36892
Documentation entry for user-facing changes
TODOs:
foo (UInt64) RETURNS UInt64queryfoo(1)does not works since1there isUInt8