From 99a1cc36bce8d55e411dd441f2219d0689a82bee Mon Sep 17 00:00:00 2001 From: Harry Bairstow Date: Wed, 21 Jun 2023 19:36:59 +0100 Subject: [PATCH 1/3] chore: Reintroduce Changes (#1) Co-authored-by: Ivan Reshetnikov --- parquet_derive/src/lib.rs | 2 +- parquet_derive/src/parquet_field.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parquet_derive/src/lib.rs b/parquet_derive/src/lib.rs index 0f875401f0e9..967041535fec 100644 --- a/parquet_derive/src/lib.rs +++ b/parquet_derive/src/lib.rs @@ -95,7 +95,7 @@ pub fn parquet_record_writer(input: proc_macro::TokenStream) -> proc_macro::Toke field_infos.iter().map(|x| x.parquet_type()).collect(); (quote! { - impl #generics ::parquet::record::RecordWriter<#derived_for #generics> for &[#derived_for #generics] { + impl #generics ::parquet::record::RecordWriter<#derived_for #generics> for [#derived_for #generics] { fn write_to_row_group( &self, row_group_writer: &mut ::parquet::file::writer::SerializedRowGroupWriter<'_, W> diff --git a/parquet_derive/src/parquet_field.rs b/parquet_derive/src/parquet_field.rs index ea6878283a33..12216de620d9 100644 --- a/parquet_derive/src/parquet_field.rs +++ b/parquet_derive/src/parquet_field.rs @@ -519,7 +519,7 @@ impl Type { } "f32" => BasicType::FLOAT, "f64" => BasicType::DOUBLE, - "String" | "str" | "Uuid" => BasicType::BYTE_ARRAY, + "String" | "str" | "Uuid" | "Arc < str >" => BasicType::BYTE_ARRAY, f => unimplemented!("{} currently is not supported", f), } } @@ -588,7 +588,7 @@ impl Type { "NaiveDate" => quote! { Some(LogicalType::Date) }, "NaiveDateTime" => quote! { None }, "f32" | "f64" => quote! { None }, - "String" | "str" => quote! { Some(LogicalType::String) }, + "String" | "str" | "Arc < str >" => quote! { Some(LogicalType::String) }, "Uuid" => quote! { Some(LogicalType::Uuid) }, f => unimplemented!("{} currently is not supported", f), } From 7f0aea1c531963792fac9435d32d1848250ef190 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Tue, 9 Dec 2025 07:08:56 +0100 Subject: [PATCH 2/3] fix: clean up --- parquet_derive/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parquet_derive/src/lib.rs b/parquet_derive/src/lib.rs index 43b220d6bab5..1aaa1abfd2a3 100644 --- a/parquet_derive/src/lib.rs +++ b/parquet_derive/src/lib.rs @@ -146,7 +146,7 @@ pub fn parquet_record_writer(input: proc_macro::TokenStream) -> proc_macro::Toke field_infos.iter().map(|x| x.parquet_type()).collect(); (quote! { - impl #generics ::parquet::record::RecordWriter<#derived_for #generics> for [#derived_for #generics] { + impl #generics ::parquet::record::RecordWriter<#derived_for #generics> for &[#derived_for #generics] { fn write_to_row_group( &self, row_group_writer: &mut ::parquet::file::writer::SerializedRowGroupWriter<'_, W> From 716de20daced8da6d609f98e1e178bf834734b06 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Tue, 9 Dec 2025 07:38:13 +0100 Subject: [PATCH 3/3] fix: update tests --- parquet_derive_test/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/parquet_derive_test/src/lib.rs b/parquet_derive_test/src/lib.rs index 71eb63606998..fe96fa0e6122 100644 --- a/parquet_derive_test/src/lib.rs +++ b/parquet_derive_test/src/lib.rs @@ -23,6 +23,7 @@ #![allow(clippy::approx_constant)] use parquet_derive::{ParquetRecordReader, ParquetRecordWriter}; +use std::sync::Arc; #[derive(ParquetRecordWriter)] struct ACompleteRecord<'a> { @@ -30,8 +31,10 @@ struct ACompleteRecord<'a> { pub a_str: &'a str, pub a_string: String, pub a_borrowed_string: &'a String, + pub a_arc_str: Arc, pub maybe_a_str: Option<&'a str>, pub maybe_a_string: Option, + pub maybe_a_arc_str: Option>, pub i16: i16, pub i32: i32, pub u64: u64, @@ -130,8 +133,10 @@ mod tests { REQUIRED BINARY a_str (STRING); REQUIRED BINARY a_string (STRING); REQUIRED BINARY a_borrowed_string (STRING); + REQUIRED BINARY a_arc_str (STRING); OPTIONAL BINARY maybe_a_str (STRING); OPTIONAL BINARY maybe_a_string (STRING); + OPTIONAL BINARY maybe_a_arc_str (STRING); REQUIRED INT32 i16 (INTEGER(16,true)); REQUIRED INT32 i32; REQUIRED INT64 u64 (INTEGER(64,false)); @@ -159,8 +164,10 @@ mod tests { let a_str = "hello mother".to_owned(); let a_borrowed_string = "cool news".to_owned(); + let a_arc_str: Arc = "hello arc".into(); let maybe_a_string = Some("it's true, I'm a string".to_owned()); let maybe_a_str = Some(&a_str[..]); + let maybe_a_arc_str = Some(a_arc_str.clone()); let borrowed_byte_vec = vec![0x68, 0x69, 0x70]; let borrowed_maybe_byte_vec = Some(vec![0x71, 0x72]); let borrowed_maybe_borrowed_byte_vec = Some(&borrowed_byte_vec[..]); @@ -170,8 +177,10 @@ mod tests { a_str: &a_str[..], a_string: "hello father".into(), a_borrowed_string: &a_borrowed_string, + a_arc_str, maybe_a_str: Some(&a_str[..]), maybe_a_string: Some(a_str.clone()), + maybe_a_arc_str, i16: -45, i32: 456, u64: 4563424,