From 76fbc469b4987370ebb788f495d9c505b90b9f80 Mon Sep 17 00:00:00 2001 From: "Jorge C. Leitao" Date: Fri, 18 Feb 2022 15:38:21 +0000 Subject: [PATCH] Updated README --- README.md | 5 +++- src/io/odbc/write/serialize.rs | 48 ++++++++++++++++------------------ 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 8da9509ce39..fcb7097089b 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,9 @@ documentation of each of its APIs. * Apache Arrow IPC (all types) * Apache Arrow Flight (all types) * Apache Parquet (except deep nested types) - * Apache Avro (not all types yet) + * Apache Avro (all types) * NJSON + * ODBC (some types) * Extensive suite of compute operations * aggregations * arithmetics @@ -57,8 +58,10 @@ documentation of each of its APIs. This crate uses `unsafe` when strickly necessary: * when the compiler can't prove certain invariants and * FFI + We have extensive tests over these, all of which run and pass under MIRI. Most uses of `unsafe` fall into 3 categories: + * The Arrow format has invariants over utf8 that can't be written in safe Rust * `TrustedLen` and trait specialization are still nightly features * FFI diff --git a/src/io/odbc/write/serialize.rs b/src/io/odbc/write/serialize.rs index 7655daf3f4a..d2e5816a1d0 100644 --- a/src/io/odbc/write/serialize.rs +++ b/src/io/odbc/write/serialize.rs @@ -15,67 +15,63 @@ pub fn serialize(array: &dyn Array, column: &mut api::buffers::AnyColumnViewMut) match array.data_type() { DataType::Boolean => { if let api::buffers::AnyColumnViewMut::Bit(values) = column { - Ok(bool(array.as_any().downcast_ref().unwrap(), values)) + bool(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else if let api::buffers::AnyColumnViewMut::NullableBit(values) = column { - Ok(bool_optional( - array.as_any().downcast_ref().unwrap(), - values, - )) + bool_optional(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else { Err(ArrowError::nyi("serialize bool to non-bool ODBC")) } } DataType::Int16 => { if let api::buffers::AnyColumnViewMut::I16(values) = column { - Ok(primitive(array.as_any().downcast_ref().unwrap(), values)) + primitive(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else if let api::buffers::AnyColumnViewMut::NullableI16(values) = column { - Ok(primitive_optional( - array.as_any().downcast_ref().unwrap(), - values, - )) + primitive_optional(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else { Err(ArrowError::nyi("serialize i16 to non-i16 ODBC")) } } DataType::Int32 => { if let api::buffers::AnyColumnViewMut::I32(values) = column { - Ok(primitive(array.as_any().downcast_ref().unwrap(), values)) + primitive(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else if let api::buffers::AnyColumnViewMut::NullableI32(values) = column { - Ok(primitive_optional( - array.as_any().downcast_ref().unwrap(), - values, - )) + primitive_optional(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else { Err(ArrowError::nyi("serialize i32 to non-i32 ODBC")) } } DataType::Float32 => { if let api::buffers::AnyColumnViewMut::F32(values) = column { - Ok(primitive(array.as_any().downcast_ref().unwrap(), values)) + primitive(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else if let api::buffers::AnyColumnViewMut::NullableF32(values) = column { - Ok(primitive_optional( - array.as_any().downcast_ref().unwrap(), - values, - )) + primitive_optional(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else { Err(ArrowError::nyi("serialize f32 to non-f32 ODBC")) } } DataType::Float64 => { if let api::buffers::AnyColumnViewMut::F64(values) = column { - Ok(primitive(array.as_any().downcast_ref().unwrap(), values)) + primitive(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else if let api::buffers::AnyColumnViewMut::NullableF64(values) = column { - Ok(primitive_optional( - array.as_any().downcast_ref().unwrap(), - values, - )) + primitive_optional(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else { Err(ArrowError::nyi("serialize f64 to non-f64 ODBC")) } } DataType::FixedSizeBinary(_) => { if let api::buffers::AnyColumnViewMut::Binary(values) = column { - Ok(binary(array.as_any().downcast_ref().unwrap(), values)) + binary(array.as_any().downcast_ref().unwrap(), values); + Ok(()) } else { Err(ArrowError::nyi("serialize f64 to non-f64 ODBC")) }