From e8e9e854250cb1b54e54a980d8a1b27c7df146b9 Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Thu, 1 Aug 2024 09:53:40 -0400 Subject: [PATCH 1/2] fix round-trip for view schema in CFFI --- arrow-schema/src/ffi.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arrow-schema/src/ffi.rs b/arrow-schema/src/ffi.rs index d12e237d7928..9e7a2b9780a8 100644 --- a/arrow-schema/src/ffi.rs +++ b/arrow-schema/src/ffi.rs @@ -390,8 +390,10 @@ impl TryFrom<&FFI_ArrowSchema> for DataType { "e" => DataType::Float16, "f" => DataType::Float32, "g" => DataType::Float64, + "vz" => DataType::BinaryView, "z" => DataType::Binary, "Z" => DataType::LargeBinary, + "vu" => DataType::Utf8View, "u" => DataType::Utf8, "U" => DataType::LargeUtf8, "tdD" => DataType::Date32, @@ -810,6 +812,10 @@ mod tests { 5, )); round_trip_type(DataType::Utf8); + round_trip_type(DataType::Utf8View); + round_trip_type(DataType::BinaryView); + round_trip_type(DataType::Binary); + round_trip_type(DataType::LargeBinary); round_trip_type(DataType::List(Arc::new(Field::new( "a", DataType::Int16, From 121001e1ede86f19c48fbddf7c38ae71df438bb3 Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Thu, 1 Aug 2024 10:02:45 -0400 Subject: [PATCH 2/2] add --- arrow-schema/src/ffi.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arrow-schema/src/ffi.rs b/arrow-schema/src/ffi.rs index 9e7a2b9780a8..b0c6a9f520ed 100644 --- a/arrow-schema/src/ffi.rs +++ b/arrow-schema/src/ffi.rs @@ -662,8 +662,10 @@ fn get_format_string(dtype: &DataType) -> Result { DataType::Float16 => Ok("e".to_string()), DataType::Float32 => Ok("f".to_string()), DataType::Float64 => Ok("g".to_string()), + DataType::BinaryView => Ok("vz".to_string()), DataType::Binary => Ok("z".to_string()), DataType::LargeBinary => Ok("Z".to_string()), + DataType::Utf8View => Ok("vu".to_string()), DataType::Utf8 => Ok("u".to_string()), DataType::LargeUtf8 => Ok("U".to_string()), DataType::FixedSizeBinary(num_bytes) => Ok(format!("w:{num_bytes}")),