pub fn transverse<T, F: Fn(&DataType) -> T + Clone>(
data_type: &DataType,
map: F
) -> Vec<T>
Expand description
Transverses the data_type
up to its (parquet) columns and returns a vector of
items based on map
.
This is used to assign an Encoding
to every parquet column based on the columns’ type (see example)
§Example
use arrow2::io::parquet::write::{transverse, Encoding};
use arrow2::datatypes::{DataType, Field};
let dt = DataType::Struct(vec![
Field::new("a", DataType::Int64, true),
Field::new("b", DataType::List(Box::new(Field::new("item", DataType::Int32, true))), true),
]);
let encodings = transverse(&dt, |dt| Encoding::Plain);
assert_eq!(encodings, vec![Encoding::Plain, Encoding::Plain]);