pub struct Column { /* private fields */ }
Expand description
Represents the column at a given index in a RecordBatch
This is a physical expression that represents a column at a given index in an
arrow Schema
/ RecordBatch
.
Unlike the logical Expr::Column
, this expression is always resolved by schema index,
even though it does have a name. This is because the physical plan is always
resolved to a specific schema and there is no concept of “relation”
§Example:
If the schema is a
, b
, c
the Column
for b
would be represented by
index 1, since b
is the second colum in the schema.
// Schema with columns a, b, c
let schema = Schema::new(vec![
Field::new("a", DataType::Int32, false),
Field::new("b", DataType::Int32, false),
Field::new("c", DataType::Int32, false),
]);
// reference to column b is index 1
let column_b = Column::new_with_schema("b", &schema).unwrap();
assert_eq!(column_b.index(), 1);
// reference to column c is index 2
let column_c = Column::new_with_schema("c", &schema).unwrap();
assert_eq!(column_c.index(), 2);
Implementations§
Source§impl Column
impl Column
Sourcepub fn new(name: &str, index: usize) -> Self
pub fn new(name: &str, index: usize) -> Self
Create a new column expression which references the column with the given index in the schema.
Sourcepub fn new_with_schema(name: &str, schema: &Schema) -> Result<Self>
pub fn new_with_schema(name: &str, schema: &Schema) -> Result<Self>
Create a new column expression which references the column with the given name in the schema
Trait Implementations§
Source§impl PhysicalExpr for Column
impl PhysicalExpr for Column
Source§fn data_type(&self, input_schema: &Schema) -> Result<DataType>
fn data_type(&self, input_schema: &Schema) -> Result<DataType>
Get the data type of this expression, given the schema of the input
Source§fn nullable(&self, input_schema: &Schema) -> Result<bool>
fn nullable(&self, input_schema: &Schema) -> Result<bool>
Decide whether this expression is nullable, given the schema of the input
Source§fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue>
fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue>
Evaluate the expression
Source§fn children(&self) -> Vec<&Arc<dyn PhysicalExpr>>
fn children(&self) -> Vec<&Arc<dyn PhysicalExpr>>
Source§fn with_new_children(
self: Arc<Self>,
_children: Vec<Arc<dyn PhysicalExpr>>,
) -> Result<Arc<dyn PhysicalExpr>>
fn with_new_children( self: Arc<Self>, _children: Vec<Arc<dyn PhysicalExpr>>, ) -> Result<Arc<dyn PhysicalExpr>>
Source§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 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.impl Eq for Column
impl StructuralPartialEq for Column
Auto Trait Implementations§
impl Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnwindSafe for Column
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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<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