From 1a240463e27193e38e33bf8113c487b3740da3e6 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Sun, 15 Jun 2025 07:39:11 -0400 Subject: [PATCH 1/3] fix: Make sqlparser's recursive-protection optional for WASM compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change addresses the PSM "section too large" error when building DataFusion for WebAssembly by making sqlparser's recursive-protection feature optional. Changes: - Set default-features = false for sqlparser in workspace Cargo.toml - Add sqlparser_std and sqlparser_recursive_protection features to datafusion crate - Include these features in datafusion's default features for backward compatibility This allows WASM builds to exclude the problematic dependency chain: sqlparser → recursive → stacker → psm While maintaining full compatibility for non-WASM builds. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Cargo.toml | 2 +- datafusion/core/Cargo.toml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 93d64cb6b6ef..241028476f7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -167,7 +167,7 @@ recursive = "0.1.1" regex = "1.8" rstest = "0.25.0" serde_json = "1" -sqlparser = { version = "0.55.0", features = ["visitor"] } +sqlparser = { version = "0.55.0", default-features = false, features = ["visitor"] } tempfile = "3" tokio = { version = "1.45", features = ["macros", "rt", "sync"] } url = "2.5.4" diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.toml index f3aa7b1e7cb1..14b6e79ada1f 100644 --- a/datafusion/core/Cargo.toml +++ b/datafusion/core/Cargo.toml @@ -62,6 +62,8 @@ default = [ "compression", "parquet", "recursive_protection", + "sqlparser_std", + "sqlparser_recursive_protection", ] encoding_expressions = ["datafusion-functions/encoding_expressions"] # Used for testing ONLY: causes all values to hash to the same value (test for collisions) @@ -79,6 +81,9 @@ recursive_protection = [ "datafusion-physical-optimizer/recursive_protection", "datafusion-sql/recursive_protection", ] +# Enable sqlparser's default features for backward compatibility +sqlparser_std = ["sqlparser/std"] +sqlparser_recursive_protection = ["sqlparser/recursive-protection"] serde = [ "dep:serde", # Enable `#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]` From 58a67fe4cf54c2e26fe2e043a39e18f5b1fb18d1 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Sun, 15 Jun 2025 08:37:09 -0400 Subject: [PATCH 2/3] fix: Include std feature for sqlparser The std feature is required for sqlparser to compile properly. Without it, basic types and imports are missing. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 241028476f7a..f2cd6f72c7e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -167,7 +167,7 @@ recursive = "0.1.1" regex = "1.8" rstest = "0.25.0" serde_json = "1" -sqlparser = { version = "0.55.0", default-features = false, features = ["visitor"] } +sqlparser = { version = "0.55.0", default-features = false, features = ["std", "visitor"] } tempfile = "3" tokio = { version = "1.45", features = ["macros", "rt", "sync"] } url = "2.5.4" From 485a5053f4750b8b83dd6c5a9a47dbfb7b5b3c3a Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Mon, 16 Jun 2025 10:31:40 -0400 Subject: [PATCH 3/3] review feedback --- datafusion/core/Cargo.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.toml index 14b6e79ada1f..6d4c18df3d47 100644 --- a/datafusion/core/Cargo.toml +++ b/datafusion/core/Cargo.toml @@ -62,8 +62,6 @@ default = [ "compression", "parquet", "recursive_protection", - "sqlparser_std", - "sqlparser_recursive_protection", ] encoding_expressions = ["datafusion-functions/encoding_expressions"] # Used for testing ONLY: causes all values to hash to the same value (test for collisions) @@ -80,10 +78,8 @@ recursive_protection = [ "datafusion-optimizer/recursive_protection", "datafusion-physical-optimizer/recursive_protection", "datafusion-sql/recursive_protection", + "sqlparser/recursive-protection", ] -# Enable sqlparser's default features for backward compatibility -sqlparser_std = ["sqlparser/std"] -sqlparser_recursive_protection = ["sqlparser/recursive-protection"] serde = [ "dep:serde", # Enable `#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]`