serde_arrow

Function from_arrow2

source
pub fn from_arrow2<'de, T, A>(fields: &[Field], arrays: &'de [A]) -> Result<T>
where T: Deserialize<'de>, A: AsRef<dyn Array>,
Expand description

Deserialize items from the given arrow2 arrays (requires one of the arrow2-* features)

The type should be a list of records (e.g., a vector of structs). To deserialize items encoding single values consider the Items wrapper.

use arrow2::datatypes::Field;
use serde::{Deserialize, Serialize};
use serde_arrow::schema::{SchemaLike, TracingOptions};

#[derive(Deserialize, Serialize)]
struct Record {
    a: Option<f32>,
    b: u64,
}

let fields = Vec::<Field>::from_type::<Record>(TracingOptions::default())?;
let items: Vec<Record> = serde_arrow::from_arrow2(&fields, &arrays)?;