Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Feb 18, 2022
1 parent 840c8a3 commit 76fbc46
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
48 changes: 22 additions & 26 deletions src/io/odbc/write/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down

0 comments on commit 76fbc46

Please sign in to comment.