pub struct ProjectionPlan {
pub physical_projection: Projection,
pub desires_row_id: bool,
pub desires_row_addr: bool,
pub requested_output_expr: Option<Vec<(Expr, String)>>,
/* private fields */
}Fields§
§physical_projection: ProjectionThe physical schema that must be loaded from the dataset
desires_row_id: boolTrue if the user wants the row id in the final output
Note: this is related, but slightly different, to physical_projection.with_row_id which only tracks if the row id is needed.
desires_row_id implies with_row_id is true However, it is possible to have desires_row_id=false and with_row_id=true (e.g. when the row id is needed to perform a late materialization take)
desires_row_addr: boolTrue if the user wants the row address in the final output
Note: this is related, but slightly different, to physical_projection.with_row_addr which only tracks if the row address is needed.
desires_row_addr implies with_row_addr is true However, it is possible to have deisres_row_addr=false and with_row_addr=true (e.g. during a count query)
requested_output_expr: Option<Vec<(Expr, String)>>If present, expressions that represent the output columns. These expressions run on the output of the physical projection.
If not present, the output is the physical projection.
Note: this doesn’t include _distance, and _rowid
Implementations§
Source§impl ProjectionPlan
impl ProjectionPlan
Sourcepub fn new(base: Arc<dyn Projectable>) -> Self
pub fn new(base: Arc<dyn Projectable>) -> Self
Create a new projection plan which projects all columns and does not include any expressions
Sourcepub fn project_from_expressions(
&mut self,
columns: &[(impl AsRef<str>, impl AsRef<str>)],
) -> Result<()>
pub fn project_from_expressions( &mut self, columns: &[(impl AsRef<str>, impl AsRef<str>)], ) -> Result<()>
Set the projection from SQL expressions
Sourcepub fn project_from_schema(&mut self, projection: &Schema)
pub fn project_from_schema(&mut self, projection: &Schema)
Set the projection from a schema
This plan will have no complex expressions
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
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