pub struct CastColumnExpr { /* private fields */ }Expand description
A physical expression that applies cast_column to its input.
CastColumnExpr extends the regular CastExpr by
retaining schema metadata for both the input and output fields. This allows
the evaluator to perform struct-aware casts that honour nested field
ordering, preserve nullability, and fill missing fields with null values.
This expression is intended for schema rewriting scenarios where the
planner already resolved the input column but needs to adapt its physical
representation to a new arrow::datatypes::Field. It mirrors the behaviour of the
datafusion_common::nested_struct::cast_column helper while integrating
with the PhysicalExpr trait so it can participate in the execution plan
like any other column expression.
Implementations§
Source§impl CastColumnExpr
impl CastColumnExpr
Sourcepub fn new(
expr: Arc<dyn PhysicalExpr>,
input_field: Arc<Field>,
target_field: Arc<Field>,
cast_options: Option<CastOptions<'static>>,
) -> CastColumnExpr
pub fn new( expr: Arc<dyn PhysicalExpr>, input_field: Arc<Field>, target_field: Arc<Field>, cast_options: Option<CastOptions<'static>>, ) -> CastColumnExpr
Create a new CastColumnExpr.
Sourcepub fn expr(&self) -> &Arc<dyn PhysicalExpr> ⓘ
pub fn expr(&self) -> &Arc<dyn PhysicalExpr> ⓘ
The expression that produces the value to be cast.
Sourcepub fn input_field(&self) -> &Arc<Field> ⓘ
pub fn input_field(&self) -> &Arc<Field> ⓘ
Field metadata describing the resolved input column.
Sourcepub fn target_field(&self) -> &Arc<Field> ⓘ
pub fn target_field(&self) -> &Arc<Field> ⓘ
Field metadata describing the output column after casting.
Trait Implementations§
Source§impl Clone for CastColumnExpr
impl Clone for CastColumnExpr
Source§fn clone(&self) -> CastColumnExpr
fn clone(&self) -> CastColumnExpr
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CastColumnExpr
impl Debug for CastColumnExpr
Source§impl Display for CastColumnExpr
impl Display for CastColumnExpr
impl Eq for CastColumnExpr
Source§impl Hash for CastColumnExpr
impl Hash for CastColumnExpr
Source§impl PartialEq for CastColumnExpr
impl PartialEq for CastColumnExpr
Source§fn eq(&self, other: &CastColumnExpr) -> bool
fn eq(&self, other: &CastColumnExpr) -> bool
self and other values to be equal, and is used by ==.Source§impl PhysicalExpr for CastColumnExpr
impl PhysicalExpr for CastColumnExpr
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any so that it can be
downcast to a specific implementation.Source§fn data_type(&self, _input_schema: &Schema) -> Result<DataType, DataFusionError>
fn data_type(&self, _input_schema: &Schema) -> Result<DataType, DataFusionError>
Source§fn nullable(&self, _input_schema: &Schema) -> Result<bool, DataFusionError>
fn nullable(&self, _input_schema: &Schema) -> Result<bool, DataFusionError>
Source§fn evaluate(
&self,
batch: &RecordBatch,
) -> Result<ColumnarValue, DataFusionError>
fn evaluate( &self, batch: &RecordBatch, ) -> Result<ColumnarValue, DataFusionError>
Source§fn return_field(
&self,
_input_schema: &Schema,
) -> Result<Arc<Field>, DataFusionError>
fn return_field( &self, _input_schema: &Schema, ) -> Result<Arc<Field>, DataFusionError>
Source§fn children(&self) -> Vec<&Arc<dyn PhysicalExpr>>
fn children(&self) -> Vec<&Arc<dyn PhysicalExpr>>
Source§fn with_new_children(
self: Arc<CastColumnExpr>,
children: Vec<Arc<dyn PhysicalExpr>>,
) -> Result<Arc<dyn PhysicalExpr>, DataFusionError>
fn with_new_children( self: Arc<CastColumnExpr>, children: Vec<Arc<dyn PhysicalExpr>>, ) -> Result<Arc<dyn PhysicalExpr>, DataFusionError>
Source§fn fmt_sql(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt_sql(&self, f: &mut Formatter<'_>) -> Result<(), Error>
PhysicalExpr in nice human readable “SQL” format Read moreSource§fn evaluate_selection(
&self,
batch: &RecordBatch,
selection: &BooleanArray,
) -> Result<ColumnarValue, DataFusionError>
fn evaluate_selection( &self, batch: &RecordBatch, selection: &BooleanArray, ) -> Result<ColumnarValue, DataFusionError>
Source§fn evaluate_bounds(
&self,
_children: &[&Interval],
) -> Result<Interval, DataFusionError>
fn evaluate_bounds( &self, _children: &[&Interval], ) -> Result<Interval, DataFusionError>
Source§fn propagate_constraints(
&self,
_interval: &Interval,
_children: &[&Interval],
) -> Result<Option<Vec<Interval>>, DataFusionError>
fn propagate_constraints( &self, _interval: &Interval, _children: &[&Interval], ) -> Result<Option<Vec<Interval>>, DataFusionError>
Source§fn evaluate_statistics(
&self,
children: &[&Distribution],
) -> Result<Distribution, DataFusionError>
fn evaluate_statistics( &self, children: &[&Distribution], ) -> Result<Distribution, DataFusionError>
Source§fn propagate_statistics(
&self,
parent: &Distribution,
children: &[&Distribution],
) -> Result<Option<Vec<Distribution>>, DataFusionError>
fn propagate_statistics( &self, parent: &Distribution, children: &[&Distribution], ) -> Result<Option<Vec<Distribution>>, DataFusionError>
Source§fn get_properties(
&self,
_children: &[ExprProperties],
) -> Result<ExprProperties, DataFusionError>
fn get_properties( &self, _children: &[ExprProperties], ) -> Result<ExprProperties, DataFusionError>
PhysicalExpr based on its
children’s properties (i.e. order and range), recursively aggregating
the information from its children. In cases where the PhysicalExpr
has no children (e.g., Literal or Column), these properties should
be specified externally, as the function defaults to unknown properties.Source§fn snapshot(&self) -> Result<Option<Arc<dyn PhysicalExpr>>, DataFusionError>
fn snapshot(&self) -> Result<Option<Arc<dyn PhysicalExpr>>, DataFusionError>
PhysicalExpr, if it is dynamic. Read moreSource§fn snapshot_generation(&self) -> u64
fn snapshot_generation(&self) -> u64
PhysicalExpr for snapshotting purposes.
The generation is an arbitrary u64 that can be used to track changes
in the state of the PhysicalExpr over time without having to do an exhaustive comparison.
This is useful to avoid unnecessary computation or serialization if there are no changes to the expression.
In particular, dynamic expressions that may change over time; this allows cheap checks for changes.
Static expressions that do not change over time should return 0, as does the default implementation.
You should not call this method directly as it does not handle recursion.
Instead use snapshot_generation to handle recursion and capture the
full state of the PhysicalExpr.Source§fn is_volatile_node(&self) -> bool
fn is_volatile_node(&self) -> bool
Source§fn placement(&self) -> ExpressionPlacement
fn placement(&self) -> ExpressionPlacement
Auto Trait Implementations§
impl !RefUnwindSafe for CastColumnExpr
impl !UnwindSafe for CastColumnExpr
impl Freeze for CastColumnExpr
impl Send for CastColumnExpr
impl Sync for CastColumnExpr
impl Unpin for CastColumnExpr
impl UnsafeUnpin for CastColumnExpr
Blanket Implementations§
Source§impl<T> AsAny for T
impl<T> AsAny for T
Source§fn any_ref(&self) -> &(dyn Any + Sync + Send + 'static)
fn any_ref(&self) -> &(dyn Any + Sync + Send + 'static)
dyn Any reference to the object: Read moreSource§fn as_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ
fn as_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ
Arc<dyn Any> reference to the object: Read moreSource§fn into_any(self: Box<T>) -> Box<dyn Any + Sync + Send>
fn into_any(self: Box<T>) -> Box<dyn Any + Sync + Send>
Box<dyn Any>: Read moreSource§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
std::any::type_name, since Any does not provide it and
Any::type_id is useless as a debugging aid (its Debug is just a mess of hex digits).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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynPartialEq for T
impl<T> DynPartialEq for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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