Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions parquet_derive/src/parquet_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down Expand Up @@ -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),
}
Expand Down
9 changes: 9 additions & 0 deletions parquet_derive_test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@
#![allow(clippy::approx_constant)]

use parquet_derive::{ParquetRecordReader, ParquetRecordWriter};
use std::sync::Arc;

#[derive(ParquetRecordWriter)]
struct ACompleteRecord<'a> {
pub a_bool: bool,
pub a_str: &'a str,
pub a_string: String,
pub a_borrowed_string: &'a String,
pub a_arc_str: Arc<str>,
pub maybe_a_str: Option<&'a str>,
pub maybe_a_string: Option<String>,
pub maybe_a_arc_str: Option<Arc<str>>,
pub i16: i16,
pub i32: i32,
pub u64: u64,
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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<str> = "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[..]);
Expand All @@ -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,
Expand Down
Loading