From 6a9e930333eebdbd70c477878c89b985eff1a1ae Mon Sep 17 00:00:00 2001 From: Adam Gutglick Date: Fri, 15 May 2026 16:12:32 +0100 Subject: [PATCH] Conditional feature --- parquet-variant-compute/Cargo.toml | 10 ++++++---- parquet-variant-json/Cargo.toml | 4 +++- parquet-variant/Cargo.toml | 9 ++++++--- parquet-variant/src/variant.rs | 4 ++++ parquet-variant/src/variant/list.rs | 4 ++++ parquet-variant/src/variant/metadata.rs | 4 ++++ parquet-variant/src/variant/object.rs | 4 ++++ 7 files changed, 31 insertions(+), 8 deletions(-) diff --git a/parquet-variant-compute/Cargo.toml b/parquet-variant-compute/Cargo.toml index 85d66a9cf706..bcfb36b8710c 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 f9550adc26af..76c639d2ee38 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 7d5064331e4c..ba186432d28f 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 accff009045a..826ce9605eac 100644 --- a/parquet-variant/src/variant.rs +++ b/parquet-variant/src/variant.rs @@ -292,8 +292,12 @@ 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::(80); +#[cfg(target_pointer_width = "32")] +const _: () = crate::utils::expect_size_of::(48); + impl<'m, 'v> Variant<'m, 'v> { /// Attempts to interpret a metadata and value buffer pair as a new `Variant`. /// diff --git a/parquet-variant/src/variant/list.rs b/parquet-variant/src/variant/list.rs index fd71afba7342..7301d0570645 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::(64); +#[cfg(target_pointer_width = "32")] +const _: () = crate::utils::expect_size_of::(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 9f9688acd090..d5d08d204c83 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::(32); +#[cfg(target_pointer_width = "32")] +const _: () = crate::utils::expect_size_of::(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 52dc2ef42f98..bb91584cefa6 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::(64); +#[cfg(target_pointer_width = "32")] +const _: () = crate::utils::expect_size_of::(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")