struct FilterCandidateBuilder {
expr: Arc<dyn PhysicalExpr>,
file_schema: SchemaRef,
table_schema: SchemaRef,
schema_adapter_factory: Arc<dyn SchemaAdapterFactory>,
}Expand description
Helper to build a FilterCandidate.
This will do several things
- Determine the columns required to evaluate the expression
- Calculate data required to estimate the cost of evaluating the filter
- Rewrite column expressions in the predicate which reference columns not in the particular file schema.
§Schema Rewrite
When parquet files are read in the context of “schema evolution” there are potentially wo schemas:
- The table schema (the columns of the table that the parquet file is part of)
- The file schema (the columns actually in the parquet file)
There are times when the table schema contains columns that are not in the file schema, such as when new columns have been added in new parquet files but old files do not have the columns.
When a file is missing a column from the table schema, the value of the
missing column is filled in by a SchemaAdapter (by default as NULL).
When a predicate is pushed down to the parquet reader, the predicate is
evaluated in the context of the file schema.
For each predicate we build a filter schema which is the projection of the table
schema that contains only the columns that this filter references.
If any columns from the file schema are missing from a particular file they are
added by the SchemaAdapter, by default as NULL.
Fields§
§expr: Arc<dyn PhysicalExpr>§file_schema: SchemaRefThe schema of this parquet file. Columns may have different types from the table schema and there may be columns in the file schema that are not in the table schema or columns that are in the table schema that are not in the file schema.
table_schema: SchemaRefThe schema of the table (merged schema) – columns may be in different order than in the file and have columns that are not in the file schema
schema_adapter_factory: Arc<dyn SchemaAdapterFactory>A SchemaAdapterFactory used to map the file schema to the table schema.
Implementations§
Source§impl FilterCandidateBuilder
impl FilterCandidateBuilder
pub fn new( expr: Arc<dyn PhysicalExpr>, file_schema: Arc<Schema>, table_schema: Arc<Schema>, schema_adapter_factory: Arc<dyn SchemaAdapterFactory>, ) -> Self
Sourcepub fn build(
self,
metadata: &ParquetMetaData,
) -> Result<Option<FilterCandidate>>
pub fn build( self, metadata: &ParquetMetaData, ) -> Result<Option<FilterCandidate>>
Attempt to build a FilterCandidate from the expression
§Return values
Ok(Some(candidate))if the expression can be used as an ArrowFilterOk(None)if the expression cannot be used as an ArrowFilterErr(e)if an error occurs while building the candidate
Auto Trait Implementations§
impl Freeze for FilterCandidateBuilder
impl !RefUnwindSafe for FilterCandidateBuilder
impl Send for FilterCandidateBuilder
impl Sync for FilterCandidateBuilder
impl Unpin for FilterCandidateBuilder
impl !UnwindSafe for FilterCandidateBuilder
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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