pub struct DefaultPhysicalExprAdapter { /* private fields */ }Expand description
Default implementation of PhysicalExprAdapter for rewriting physical
expressions to match different schemas.
§Overview
DefaultPhysicalExprAdapter rewrites physical expressions to match
different schemas, including:
-
Type casting: When logical and physical schemas have different types, expressions are automatically wrapped with cast operations. For example,
lit(ScalarValue::Int32(123)) = int64_columngets rewritten tolit(ScalarValue::Int32(123)) = cast(int64_column, 'Int32'). Note that this does not attempt to simplify such expressions - that is done by shared simplifiers. -
Missing columns: When a column exists in the logical schema but not in the physical schema, references to it are replaced with null literals.
-
Struct field access: Expressions like
struct_column.field_that_is_missing_in_schemaare rewritten tonullwhen the field doesn’t exist in the physical schema. -
Default column values: Partition column references can be replaced with their literal values when scanning specific partitions. See
replace_columns_with_literalsfor more details.
§Example
let factory = DefaultPhysicalExprAdapterFactory;
let adapter = factory.create(Arc::new(logical_file_schema.clone()), Arc::new(physical_file_schema.clone()));
let adapted_predicate = adapter.rewrite(predicate)?;Implementations§
Source§impl DefaultPhysicalExprAdapter
impl DefaultPhysicalExprAdapter
Sourcepub fn new(
logical_file_schema: SchemaRef,
physical_file_schema: SchemaRef,
) -> Self
pub fn new( logical_file_schema: SchemaRef, physical_file_schema: SchemaRef, ) -> Self
Create a new instance of the default physical expression adapter.
This adapter rewrites expressions to match the physical schema of the file being scanned, handling type mismatches and missing columns by filling them with default values.
Trait Implementations§
Source§impl Clone for DefaultPhysicalExprAdapter
impl Clone for DefaultPhysicalExprAdapter
Source§fn clone(&self) -> DefaultPhysicalExprAdapter
fn clone(&self) -> DefaultPhysicalExprAdapter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DefaultPhysicalExprAdapter
impl Debug for DefaultPhysicalExprAdapter
Source§impl PhysicalExprAdapter for DefaultPhysicalExprAdapter
impl PhysicalExprAdapter for DefaultPhysicalExprAdapter
Source§fn rewrite(&self, expr: Arc<dyn PhysicalExpr>) -> Result<Arc<dyn PhysicalExpr>>
fn rewrite(&self, expr: Arc<dyn PhysicalExpr>) -> Result<Arc<dyn PhysicalExpr>>
Auto Trait Implementations§
impl Freeze for DefaultPhysicalExprAdapter
impl RefUnwindSafe for DefaultPhysicalExprAdapter
impl Send for DefaultPhysicalExprAdapter
impl Sync for DefaultPhysicalExprAdapter
impl Unpin for DefaultPhysicalExprAdapter
impl UnsafeUnpin for DefaultPhysicalExprAdapter
impl UnwindSafe for DefaultPhysicalExprAdapter
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> 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