This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 5372e8acf7 Fix parquet-variant build on wasm targets (#9978)
5372e8acf7 is described below
commit 5372e8acf70ba6a9455d8b98edddb7368e4c71f5
Author: Adam Gutglick <[email protected]>
AuthorDate: Fri May 22 19:23:31 2026 +0100
Fix parquet-variant build on wasm targets (#9978)
# Which issue does this PR close?
- Closes #9977
# Rationale for this change
Seems like a trivial fix to get it building on more targets.
# What changes are included in this PR?
1. enables a feature for `uuid` that is required to build on WASM (only
when building for WASM).
2. Change the const size assertions to take pointer_width into account
# Are these changes tested?
I've tested the change locally (for both WASM targets), not sure if its
worth it to add to CI that currently only tests the top-level `arrow`
crate on WASM
# Are there any user-facing changes?
None
---
parquet-variant-compute/Cargo.toml | 10 ++++++----
parquet-variant-json/Cargo.toml | 4 +++-
parquet-variant/Cargo.toml | 9 ++++++---
parquet-variant/src/variant.rs | 3 +++
parquet-variant/src/variant/list.rs | 4 ++++
parquet-variant/src/variant/metadata.rs | 4 ++++
parquet-variant/src/variant/object.rs | 4 ++++
7 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/parquet-variant-compute/Cargo.toml
b/parquet-variant-compute/Cargo.toml
index 85d66a9cf7..bcfb36b871 100644
--- a/parquet-variant-compute/Cargo.toml
+++ b/parquet-variant-compute/Cargo.toml
@@ -27,18 +27,21 @@ keywords = ["arrow", "parquet", "variant"]
edition = { workspace = true }
rust-version = { workspace = true }
-
[dependencies]
-arrow = { workspace = true , features = ["canonical_extension_types"]}
+arrow = { workspace = true, features = ["canonical_extension_types"] }
arrow-schema = { workspace = true }
half = { version = "2.1", default-features = false }
indexmap = "2.10.0"
parquet-variant = { workspace = true }
parquet-variant-json = { workspace = true }
chrono = { workspace = true }
-uuid = { version = "1.18.0", features = ["v4"]}
+uuid = { version = "1.18.0", features = ["v4"] }
serde_json = "1.0"
+# uuid requires the `js` feature to run on wasm
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+uuid = { version = "1.18.0", features = ["v4", "js"] }
+
[lib]
name = "parquet_variant_compute"
bench = false
@@ -48,7 +51,6 @@ rand = "0.9.1"
criterion = { workspace = true, default-features = false }
arrow = { workspace = true, features = ["test_utils"] }
-
[[bench]]
name = "variant_kernels"
harness = false
diff --git a/parquet-variant-json/Cargo.toml b/parquet-variant-json/Cargo.toml
index f9550adc26..76c639d2ee 100644
--- a/parquet-variant-json/Cargo.toml
+++ b/parquet-variant-json/Cargo.toml
@@ -28,7 +28,6 @@ readme = "../parquet-variant/README.md"
edition = { workspace = true }
rust-version = { workspace = true }
-
[dependencies]
arrow-schema = { workspace = true }
parquet-variant = { workspace = true }
@@ -37,6 +36,9 @@ serde_json = "1.0"
base64 = "0.22"
uuid = "1.18.0"
+# uuid requires the `js` feature to run on wasm
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+uuid = { version = "1.18.0", features = ["js"] }
[lib]
name = "parquet_variant_json"
diff --git a/parquet-variant/Cargo.toml b/parquet-variant/Cargo.toml
index 7d5064331e..ba186432d2 100644
--- a/parquet-variant/Cargo.toml
+++ b/parquet-variant/Cargo.toml
@@ -29,15 +29,18 @@ edition = { workspace = true }
rust-version = { workspace = true }
[dependencies]
-arrow = { workspace = true , features = ["canonical_extension_types"] }
+arrow = { workspace = true, features = ["canonical_extension_types"] }
arrow-schema = { workspace = true }
chrono = { workspace = true }
half = { version = "2.1", default-features = false }
indexmap = "2.10.0"
num-traits = { version = "0.2", default-features = false }
-uuid = { version = "1.18.0", features = ["v4"]}
+uuid = { version = "1.18.0", features = ["v4"] }
+simdutf8 = { workspace = true, optional = true }
-simdutf8 = { workspace = true , optional = true }
+# uuid requires the `js` feature to run on wasm
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+uuid = { version = "1.18.0", features = ["v4", "js"] }
[lib]
name = "parquet_variant"
diff --git a/parquet-variant/src/variant.rs b/parquet-variant/src/variant.rs
index 3b5a04ddfd..58a3f7eeb2 100644
--- a/parquet-variant/src/variant.rs
+++ b/parquet-variant/src/variant.rs
@@ -298,7 +298,10 @@ pub enum Variant<'m, 'v> {
}
// We don't want this to grow because it could hurt performance of a
frequently-created type.
+#[cfg(target_pointer_width = "64")]
const _: () = crate::utils::expect_size_of::<Variant>(80);
+#[cfg(target_pointer_width = "32")]
+const _: () = crate::utils::expect_size_of::<Variant>(48);
enum NumericKind {
Integer,
diff --git a/parquet-variant/src/variant/list.rs
b/parquet-variant/src/variant/list.rs
index fd71afba73..7301d05706 100644
--- a/parquet-variant/src/variant/list.rs
+++ b/parquet-variant/src/variant/list.rs
@@ -128,8 +128,12 @@ pub struct VariantList<'m, 'v> {
}
// We don't want this to grow because it could increase the size of `Variant`
and hurt performance.
+#[cfg(target_pointer_width = "64")]
const _: () = crate::utils::expect_size_of::<VariantList>(64);
+#[cfg(target_pointer_width = "32")]
+const _: () = crate::utils::expect_size_of::<VariantList>(40);
+
impl<'m, 'v> VariantList<'m, 'v> {
/// Attempts to interpret `value` as a variant array value.
///
diff --git a/parquet-variant/src/variant/metadata.rs
b/parquet-variant/src/variant/metadata.rs
index 9f9688acd0..d5d08d204c 100644
--- a/parquet-variant/src/variant/metadata.rs
+++ b/parquet-variant/src/variant/metadata.rs
@@ -140,8 +140,12 @@ pub struct VariantMetadata<'m> {
// We don't want this to grow because it increases the size of VariantList and
VariantObject, which
// could increase the size of Variant. All those size increases could hurt
performance.
+#[cfg(target_pointer_width = "64")]
const _: () = crate::utils::expect_size_of::<VariantMetadata>(32);
+#[cfg(target_pointer_width = "32")]
+const _: () = crate::utils::expect_size_of::<VariantMetadata>(20);
+
/// The canonical byte slice corresponding to an empty metadata dictionary.
///
/// ```
diff --git a/parquet-variant/src/variant/object.rs
b/parquet-variant/src/variant/object.rs
index 52dc2ef42f..bb91584cef 100644
--- a/parquet-variant/src/variant/object.rs
+++ b/parquet-variant/src/variant/object.rs
@@ -127,8 +127,12 @@ pub struct VariantObject<'m, 'v> {
}
// We don't want this to grow because it could increase the size of `Variant`
and hurt performance.
+#[cfg(target_pointer_width = "64")]
const _: () = crate::utils::expect_size_of::<VariantObject>(64);
+#[cfg(target_pointer_width = "32")]
+const _: () = crate::utils::expect_size_of::<VariantObject>(44);
+
impl<'m, 'v> VariantObject<'m, 'v> {
pub fn new(metadata: VariantMetadata<'m>, value: &'v [u8]) -> Self {
Self::try_new_with_shallow_validation(metadata, value).expect("Invalid
variant object")