Support multi-partitions when compiling DataFusion to wasm
target
#15599
Labels
enhancement
New feature or request
wasm
target
#15599
Is your feature request related to a problem or challenge?
This test case will fail (assuming #15595 is merged):
To reproduce, you need to copy the test to
datafusion/wasmtest/src/lib.rs
and run:wasm-pack test --headless --chrome
It fails with:
However, if you change to
with_partitions(1)
, the test will pass.Related to #14478 (might be too advanced for a gsoc project though)
#13815 #13715 #13818
Describe the solution you'd like
It fails because it tries to span tokio tasks in browser, which does not have a tokio runner.
Instead, it should spawn the task to browser's event_loop, which imo is quite non-trivial.
This requires us to have a wasm-specific implementation of JoinSet, which spawns tasks to browser event loop rather than tokio runtime.
A deeper implication is that this also moves DataFusion towards a runtime-agnostic design. I personally believe this is a good thing, but I'm not sure if it is worth the effort.
Describe alternatives you've considered
If we do nothing, everything still works, just means that DataFusion on wasm can only use a single partition, thus single threaded.
Or we can wait and see if wasi becomes the standard and "DataFusion on wasm" is not
wasm32-unknown-unknown
, but ratherwasm32-wasi
, which should magically fix the problem. However, I expect this to take many years to become a reality.(cc @alamb, this is the reason parquet-viewer stays single-threaded)
Additional context
Reference: https://github.com/cunarist/tokio-with-wasm
The text was updated successfully, but these errors were encountered: