pub struct Projector { /* private fields */ }Expand description
Applies a projection to record batches.
A Projector uses a set of projection expressions to transform
and a pre-computed output schema to project record batches accordingly.
The main reason to use a Projector is to avoid repeatedly computing
the output schema for each batch, which can be costly if the projection
expressions are complex.
Implementations§
Source§impl Projector
impl Projector
Sourcepub fn with_metrics(
&self,
metrics: &ExecutionPlanMetricsSet,
partition: usize,
) -> Self
pub fn with_metrics( &self, metrics: &ExecutionPlanMetricsSet, partition: usize, ) -> Self
Construct the projector with metrics. After execution, related metrics will
be tracked inside ExecutionPlanMetricsSet
See ExpressionEvaluatorMetrics for details.
Sourcepub fn project_batch(&self, batch: &RecordBatch) -> Result<RecordBatch>
pub fn project_batch(&self, batch: &RecordBatch) -> Result<RecordBatch>
Project a record batch according to this projector’s expressions.
§Errors
This function returns an error if any expression evaluation fails or if the output schema of the resulting record batch does not match the pre-computed output schema of the projector.
pub fn output_schema(&self) -> &SchemaRef
pub fn projection(&self) -> &ProjectionExprs
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Projector
impl !RefUnwindSafe for Projector
impl Send for Projector
impl Sync for Projector
impl Unpin for Projector
impl !UnwindSafe for Projector
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more