pub struct ProjectionPlan {
pub physical_projection: Projection,
pub must_add_row_offset: bool,
pub requested_output_expr: Vec<OutputColumn>,
}
Fields§
§physical_projection: Projection
The physical schema that must be loaded from the dataset
must_add_row_offset: bool
Needs the row address converted into a row offset
requested_output_expr: Vec<OutputColumn>
The desired output columns
Implementations§
Source§impl ProjectionPlan
impl ProjectionPlan
Sourcepub fn from_expressions(
base: Arc<dyn Projectable>,
columns: &[(impl AsRef<str>, impl AsRef<str>)],
) -> Result<Self>
pub fn from_expressions( base: Arc<dyn Projectable>, columns: &[(impl AsRef<str>, impl AsRef<str>)], ) -> Result<Self>
Set the projection from SQL expressions
Sourcepub fn from_schema(
base: Arc<dyn Projectable>,
projection: &Schema,
) -> Result<Self>
pub fn from_schema( base: Arc<dyn Projectable>, projection: &Schema, ) -> Result<Self>
Set the projection from a schema
This plan will have no complex expressions, the schema must be a subset of the dataset schema.
With this approach it is possible to refer to portions of nested fields.
For example, if the schema is:
{
"metadata": {
"location": {
"x": f32,
"y": f32,
},
"age": i32,
}
}
It is possible to project a partial schema that drops y
like:
{
"metadata": {
"location": {
"x": f32,
},
"age": i32,
}
}
This is something that cannot be done easily using expressions.
pub fn full(base: Arc<dyn Projectable>) -> Result<Self>
Sourcepub fn to_physical_exprs(
&self,
current_schema: &ArrowSchema,
) -> Result<Vec<(Arc<dyn PhysicalExpr>, String)>>
pub fn to_physical_exprs( &self, current_schema: &ArrowSchema, ) -> Result<Vec<(Arc<dyn PhysicalExpr>, String)>>
Convert the projection to a list of physical expressions
This is used to apply the final projection (including dynamic expressions) to the data.
Sourcepub fn include_row_id(&mut self)
pub fn include_row_id(&mut self)
Include the row id in the output
Sourcepub fn include_row_addr(&mut self)
pub fn include_row_addr(&mut self)
Include the row address in the output
pub fn include_row_offset(&mut self)
Sourcepub fn has_output_cols(&self) -> bool
pub fn has_output_cols(&self) -> bool
Check if the projection has any output columns
This doesn’t mean there is a physical projection. For example, we may someday support
something like SELECT 1 AS foo
which would have an output column (foo) but no physical projection
pub fn output_schema(&self) -> Result<ArrowSchema>
pub async fn project_batch(&self, batch: RecordBatch) -> Result<RecordBatch>
Trait Implementations§
Source§impl Clone for ProjectionPlan
impl Clone for ProjectionPlan
Source§fn clone(&self) -> ProjectionPlan
fn clone(&self) -> ProjectionPlan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ProjectionPlan
impl !RefUnwindSafe for ProjectionPlan
impl Send for ProjectionPlan
impl Sync for ProjectionPlan
impl Unpin for ProjectionPlan
impl !UnwindSafe for ProjectionPlan
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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