pub struct PackExpr { /* private fields */ }Expand description
Pack zero or more expressions into a structure with named fields.
§Examples
use vortex_array::{IntoArray, ToCanonical};
use vortex_buffer::buffer;
use vortex_expr::{root, PackExpr, Scope, VortexExpr};
use vortex_scalar::Scalar;
use vortex_dtype::Nullability;
let example = PackExpr::try_new(
["x", "x copy", "second x copy"].into(),
vec![root(), root(), root()],
Nullability::NonNullable,
).unwrap();
let packed = example.evaluate(&Scope::new(buffer![100, 110, 200].into_array())).unwrap();
let x_copy = packed
.to_struct()
.unwrap()
.field_by_name("x copy")
.unwrap()
.clone();
assert_eq!(x_copy.scalar_at(0).unwrap(), Scalar::from(100));
assert_eq!(x_copy.scalar_at(1).unwrap(), Scalar::from(110));
assert_eq!(x_copy.scalar_at(2).unwrap(), Scalar::from(200));Implementations§
Source§impl PackExpr
impl PackExpr
pub fn try_new( names: FieldNames, values: Vec<ExprRef>, nullability: Nullability, ) -> VortexResult<Self>
pub fn try_new_expr( names: FieldNames, values: Vec<ExprRef>, nullability: Nullability, ) -> VortexResult<ExprRef>
pub fn names(&self) -> &FieldNames
pub fn field(&self, field_name: &FieldName) -> VortexResult<ExprRef>
pub fn nullability(&self) -> Nullability
Methods from Deref<Target = dyn VortexExpr>§
pub fn id(&self) -> ExprId
pub fn is<V: VTable>(&self) -> bool
pub fn as_<V: VTable>(&self) -> &V::Expr
pub fn as_opt<V: VTable>(&self) -> Option<&V::Expr>
Sourcepub fn evaluate(&self, scope: &Scope) -> VortexResult<ArrayRef>
pub fn evaluate(&self, scope: &Scope) -> VortexResult<ArrayRef>
Compute result of expression on given batch producing a new batch
Trait Implementations§
Source§impl AnalysisExpr for PackExpr
impl AnalysisExpr for PackExpr
Source§fn stat_falsification(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
fn stat_falsification(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
An expression over zone-statistics which implies all records in the zone evaluate to false. Read more
Source§fn max(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
fn max(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
An expression for the upper non-null bound of this expression, if available. Read more
Source§fn min(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
fn min(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
An expression for the lower non-null bound of this expression, if available. Read more
Source§fn nan_count(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
fn nan_count(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
An expression for the NaN count for a column, if available. Read more
fn field_path(&self) -> Option<FieldPath>
Source§impl AsRef<dyn VortexExpr> for PackExpr
impl AsRef<dyn VortexExpr> for PackExpr
Source§fn as_ref(&self) -> &dyn VortexExpr
fn as_ref(&self) -> &dyn VortexExpr
Converts this type into a shared reference of the (usually inferred) input type.
impl Eq for PackExpr
impl StructuralPartialEq for PackExpr
Auto Trait Implementations§
impl Freeze for PackExpr
impl !RefUnwindSafe for PackExpr
impl Send for PackExpr
impl Sync for PackExpr
impl Unpin for PackExpr
impl !UnwindSafe for PackExpr
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
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>
Converts
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>
Converts
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