diff --git a/parquet_derive/src/parquet_field.rs b/parquet_derive/src/parquet_field.rs index f51c22f65f3c..7473f2305517 100644 --- a/parquet_derive/src/parquet_field.rs +++ b/parquet_derive/src/parquet_field.rs @@ -643,7 +643,7 @@ impl Type { } "f32" => BasicType::FLOAT, "f64" => BasicType::DOUBLE, - "String" | "str" => BasicType::BYTE_ARRAY, + "String" | "str" | "Arc < str >" => BasicType::BYTE_ARRAY, "Uuid" => BasicType::FIXED_LEN_BYTE_ARRAY, f => unimplemented!("{} currently is not supported", f), } @@ -733,7 +733,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), } 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,