This is an automated email from the ASF dual-hosted git repository.
scovich 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 4d8e8baed0 chore: remove duplicate macro
`partially_shredded_variant_array_gen` (#9498)
4d8e8baed0 is described below
commit 4d8e8baed0a712f875d7ee83536be2c983261631
Author: Yan Tingwang <[email protected]>
AuthorDate: Tue Mar 3 05:48:19 2026 +0800
chore: remove duplicate macro `partially_shredded_variant_array_gen` (#9498)
# Which issue does this PR close?
- Closes #9492 .
# What changes are included in this PR?
See title.
# Are these changes tested?
YES
# Are there any user-facing changes?
NO
---
parquet-variant-compute/src/variant_get.rs | 48 ++----------------------------
1 file changed, 2 insertions(+), 46 deletions(-)
diff --git a/parquet-variant-compute/src/variant_get.rs
b/parquet-variant-compute/src/variant_get.rs
index f9985084cc..e02518057b 100644
--- a/parquet-variant-compute/src/variant_get.rs
+++ b/parquet-variant-compute/src/variant_get.rs
@@ -466,6 +466,8 @@ mod test {
macro_rules! partially_shredded_variant_array_gen {
($func_name:ident, $typed_value_array_gen: expr) => {
fn $func_name() -> ArrayRef {
+ // At the time of writing, the `VariantArrayBuilder` does not
support shredding.
+ // so we must construct the array manually. see
https://github.com/apache/arrow-rs/issues/7895
let (metadata, string_value) = {
let mut builder = parquet_variant::VariantBuilder::new();
builder.append_value("n/a");
@@ -1674,52 +1676,6 @@ mod test {
};
}
- macro_rules! partially_shredded_variant_array_gen {
- ($func:ident, $typed_array_gen: expr) => {
- fn $func() -> ArrayRef {
- // At the time of writing, the `VariantArrayBuilder` does not
support shredding.
- // so we must construct the array manually. see
https://github.com/apache/arrow-rs/issues/7895
- let (metadata, string_value) = {
- let mut builder = parquet_variant::VariantBuilder::new();
- builder.append_value("n/a");
- builder.finish()
- };
-
- let nulls = NullBuffer::from(vec![
- true, // row 0 non null
- false, // row 1 is null
- true, // row 2 non null
- true, // row 3 non null
- ]);
-
- // metadata is the same for all rows
- let metadata =
BinaryViewArray::from_iter_values(std::iter::repeat_n(&metadata, 4));
-
- // See
https://docs.google.com/document/d/1pw0AWoMQY3SjD7R4LgbPvMjG_xSCtXp3rZHkVp9jpZ4/edit?disco=AAABml8WQrY
- // about why row1 is an empty but non null, value.
- let values = BinaryViewArray::from(vec![
- None, // row 0 is shredded, so no value
- Some(b"" as &[u8]), // row 1 is null, so empty value
(why?)
- Some(&string_value), // copy the string value "N/A"
- None, // row 3 is shredded, so no value
- ]);
-
- let typed_value = $typed_array_gen();
-
- let struct_array = StructArrayBuilder::new()
- .with_field("metadata", Arc::new(metadata), false)
- .with_field("typed_value", Arc::new(typed_value), true)
- .with_field("value", Arc::new(values), true)
- .with_nulls(nulls)
- .build();
-
- ArrayRef::from(
- VariantArray::try_new(&struct_array).expect("should create
variant array"),
- )
- }
- };
- }
-
numeric_partially_shredded_variant_array_fn!(
partially_shredded_int8_variant_array,
Int8Array,