Function arrow::compute::filter

source ·
pub fn filter(
    values: &dyn Array,
    predicate: &BooleanArray,
) -> Result<Arc<dyn Array>, ArrowError>
Expand description

Filters an Array, returning elements matching the filter (i.e. where the values are true).

§Example

let array = Int32Array::from(vec![5, 6, 7, 8, 9]);
let filter_array = BooleanArray::from(vec![true, false, false, true, false]);
let c = filter(&array, &filter_array).unwrap();
let c = c.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(c, &Int32Array::from(vec![5, 8]));