jonmmease opened a new pull request, #16418:
URL: https://github.com/apache/datafusion/pull/16418

   ## Summary
   
   This PR fixes the WASM compilation issue (#13513) by making sqlparser's 
`recursive-protection` feature optional. This allows DataFusion to be compiled 
for WebAssembly targets without encountering the "LLVM error: section too 
large" error caused by the PSM (Portable Stack Manipulation) dependency.
   
   ## Background
   
   When compiling DataFusion for WASM (target `wasm32-unknown-unknown`), the 
build fails with:
   ```
   error: failed to build archive at `.../libpsm-xxx.rlib`: LLVM error: section 
too large
   ```
   
   The dependency chain causing this issue is:
   ```
   datafusion → datafusion-sql → sqlparser (with default features) → recursive 
→ stacker → psm
   ```
   
   The PSM crate is incompatible with WebAssembly because.
   
   As noted in the [PSM 
documentation](https://github.com/rust-lang/stacker/blob/master/psm/README.mkd) 
itself:
   > "This library is not applicable to the target. WASM hasn't a specified C 
ABI, the callstack is not even in an address space and does not appear to be 
manipulatable."
   
   ## The Fix
   
   This PR implements a solution that maintains backward compatibility while 
enabling WASM builds:
   
   1. **Workspace Level**: Set `default-features = false` for sqlparser to 
prevent automatic inclusion of `recursive-protection`
   2. **DataFusion Core**: Add explicit feature flags for sqlparser's default 
features:
      - `sqlparser_std` → enables `sqlparser/std`
      - `sqlparser_recursive_protection` → enables 
`sqlparser/recursive-protection`
   3. **Default Features**: Include these flags in DataFusion's default 
features to maintain backward compatibility
   
   ## Usage
   
   After this change:
   
   ### For WASM builds (no PSM dependency):
   ```toml
   datafusion = { version = "48.0.0", default-features = false, features = 
["parquet", "sqlparser_std"] }
   ```
   
   ### For regular builds (unchanged behavior):
   ```toml
   datafusion = "48.0.0"  # Includes all default features including recursive 
protection
   ```
   
   ## Related Issues and Context
   
   - Fixes #13513: "recursive" Dependency Causes "section too large" Error When 
Compiling for wasm
   - Builds upon the work in PR #13887 which made recursive_protection optional 
in datafusion-sql
   
   ## Notes
   
   While PR #13887 made `recursive_protection` optional in datafusion-sql, it 
didn't fully solve the WASM compilation issue because sqlparser itself was 
still being pulled in with its default features across multiple DataFusion 
crates. This PR completes the fix by ensuring sqlparser's default features can 
be controlled at the workspace level.
   
   


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to