Macro datafusion::common::arrow::downcast_primitive_array
source ยท macro_rules! downcast_primitive_array { ($values:ident => $e:expr, $($p:pat => $fallback:expr $(,)*)*) => { ... }; (($($values:ident),+) => $e:expr, $($p:pat => $fallback:expr $(,)*)*) => { ... }; ($($values:ident),+ => $e:block $($p:pat => $fallback:expr $(,)*)*) => { ... }; (($($values:ident),+) => $e:block $($p:pat => $fallback:expr $(,)*)*) => { ... }; }
Expand description
Downcast an Array
to a PrimitiveArray
based on its DataType
accepts a number of subsequent patterns to match the data type
fn print_primitive(array: &dyn Array) {
downcast_primitive_array!(
array => {
for v in array {
println!("{:?}", v);
}
}
DataType::Utf8 => {
for v in as_string_array(array) {
println!("{:?}", v);
}
}
t => println!("Unsupported datatype {}", t)
)
}