kentkwu opened a new issue, #24274:
URL: https://github.com/apache/datafusion/issues/24274

   ### Describe the bug
   
   DataFusion compiled to `wasm32-unknown-unknown` panics on `CREATE TABLE ... 
AS SELECT` and any other query routed through 
`physical_plan::collect_partitioned` (e.g. `MemTable::load`)
   
   `collect_partitioned` calls `JoinSet::spawn`, which needs a tokio reactor 
that isn't installed under `wasm-bindgen-futures`. The panic:
   
   ```
   there is no reactor running, must be called from the context of a Tokio 1.x 
runtime
   ```
   
   `MemTable::load` is affected for the same reason (it also calls 
`collect_partitioned`)
   
   
   
   ### To Reproduce
   
   Add this example to `datafusion/wasmtest/src/lib.rs`:
   
   ```rust
   #[wasm_bindgen_test(unsupported = tokio::test)]
   async fn test_create_table_as_select() {
       let ctx = get_ctx();
       ctx.sql("CREATE TABLE t AS SELECT 1 AS a, 'x' AS b")
           .await.unwrap()
           .collect().await.unwrap();
   }
   ```
   
   Run from the repo root:
   
   ```sh
   RUSTFLAGS='--cfg getrandom_backend="wasm_js"' \
   wasm-pack test --headless --chrome datafusion/wasmtest
   ```
   
   The test panics:
   
   ```
   panicked at datafusion/common-runtime/src/join_set.rs:69:20:
   there is no reactor running, must be called from the context of a Tokio 1.x 
runtime
   ```
   
   ### Expected behavior
   
   `CREATE TABLE ... AS SELECT` should succeed in a browser build using 
`wasm-bindgen-futures` for the single-partition case, as this is the idiomatic 
pattern for browser WASM.
   
   ### Additional context
   
   - Panic site: `datafusion/common-runtime/src/join_set.rs:69` (via 
`join_set.spawn(...)` in `datafusion/physical-plan/src/execution_plan.rs:1624`).
   - Related to #13815


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to