pub struct Filter<F>{ /* private fields */ }Expand description
A transform that filters rows based on a predicate.
The predicate function receives a RecordBatch and must return a BooleanArray
with the same number of rows, where true indicates the row should be kept.
§Example
ⓘ
use alimentar::Filter;
use arrow::array::{Int32Array, BooleanArray};
let filter = Filter::new(|batch| {
let col = batch.column(0).as_any().downcast_ref::<Int32Array>().unwrap();
let mask: Vec<bool> = (0..col.len()).map(|i| col.value(i) > 5).collect();
Ok(BooleanArray::from(mask))
});Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for Filter<F>where
F: Freeze,
impl<F> RefUnwindSafe for Filter<F>where
F: RefUnwindSafe,
impl<F> Send for Filter<F>
impl<F> Sync for Filter<F>
impl<F> Unpin for Filter<F>where
F: Unpin,
impl<F> UnsafeUnpin for Filter<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for Filter<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.