pub struct AsyncFuncExpr {
pub name: String,
pub func: Arc<dyn PhysicalExpr>,
/* private fields */
}
Expand description
Wrapper around a scalar function that can be evaluated asynchronously
Fields§
§name: String
The name of the output column this function will generate
func: Arc<dyn PhysicalExpr>
The actual function (always ScalarFunctionExpr
)
Implementations§
Source§impl AsyncFuncExpr
impl AsyncFuncExpr
Sourcepub fn try_new(
name: impl Into<String>,
func: Arc<dyn PhysicalExpr>,
schema: &Schema,
) -> Result<Self>
pub fn try_new( name: impl Into<String>, func: Arc<dyn PhysicalExpr>, schema: &Schema, ) -> Result<Self>
create a new AsyncFuncExpr
Sourcepub fn field(&self, input_schema: &Schema) -> Result<Field>
pub fn field(&self, input_schema: &Schema) -> Result<Field>
Return the output field generated by evaluating this function
Sourcepub fn ideal_batch_size(&self) -> Result<Option<usize>>
pub fn ideal_batch_size(&self) -> Result<Option<usize>>
Return the ideal batch size for this function
Sourcepub async fn invoke_with_args(
&self,
batch: &RecordBatch,
option: &ConfigOptions,
) -> Result<ColumnarValue>
pub async fn invoke_with_args( &self, batch: &RecordBatch, option: &ConfigOptions, ) -> Result<ColumnarValue>
This (async) function is called for each record batch to evaluate the LLM expressions
The output is the output of evaluating the async expression and the input record batch
Trait Implementations§
Source§impl Clone for AsyncFuncExpr
impl Clone for AsyncFuncExpr
Source§fn clone(&self) -> AsyncFuncExpr
fn clone(&self) -> AsyncFuncExpr
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AsyncFuncExpr
impl Debug for AsyncFuncExpr
Source§impl Display for AsyncFuncExpr
impl Display for AsyncFuncExpr
Source§impl Hash for AsyncFuncExpr
impl Hash for AsyncFuncExpr
Source§impl PartialEq for AsyncFuncExpr
impl PartialEq for AsyncFuncExpr
Source§impl PhysicalExpr for AsyncFuncExpr
impl PhysicalExpr for AsyncFuncExpr
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Returns the physical expression as
Any
so that it can be
downcast to a specific implementation.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>
Determine 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 an expression against a RecordBatch
Source§fn children(&self) -> Vec<&Arc<dyn PhysicalExpr>>
fn children(&self) -> Vec<&Arc<dyn PhysicalExpr>>
Get a list of child PhysicalExpr that provide the input for this expr.
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>>
Returns a new PhysicalExpr where all children were replaced by new exprs.
Source§fn fmt_sql(&self, f: &mut Formatter<'_>) -> Result
fn fmt_sql(&self, f: &mut Formatter<'_>) -> Result
Format this
PhysicalExpr
in nice human readable “SQL” format Read moreSource§fn return_field(
&self,
input_schema: &Schema,
) -> Result<Arc<Field>, DataFusionError>
fn return_field( &self, input_schema: &Schema, ) -> Result<Arc<Field>, DataFusionError>
The output field associated with this expression
Source§fn evaluate_selection(
&self,
batch: &RecordBatch,
selection: &BooleanArray,
) -> Result<ColumnarValue, DataFusionError>
fn evaluate_selection( &self, batch: &RecordBatch, selection: &BooleanArray, ) -> Result<ColumnarValue, DataFusionError>
Evaluate an expression against a RecordBatch after first applying a
validity array
Source§fn evaluate_bounds(
&self,
_children: &[&Interval],
) -> Result<Interval, DataFusionError>
fn evaluate_bounds( &self, _children: &[&Interval], ) -> Result<Interval, DataFusionError>
Computes the output interval for the expression, given the input
intervals. Read more
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>
Updates bounds for child expressions, given a known interval for this
expression. Read more
Source§fn evaluate_statistics(
&self,
children: &[&Distribution],
) -> Result<Distribution, DataFusionError>
fn evaluate_statistics( &self, children: &[&Distribution], ) -> Result<Distribution, DataFusionError>
Computes the output statistics for the expression, given the input
statistics. Read more
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>
Updates children statistics using the given parent statistic for this
expression. Read more
Source§fn get_properties(
&self,
_children: &[ExprProperties],
) -> Result<ExprProperties, DataFusionError>
fn get_properties( &self, _children: &[ExprProperties], ) -> Result<ExprProperties, DataFusionError>
Calculates the properties of this
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>
Take a snapshot of this
PhysicalExpr
, if it is dynamic. Read moreSource§fn snapshot_generation(&self) -> u64
fn snapshot_generation(&self) -> u64
Returns the generation of this
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 unecessary 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
.impl Eq for AsyncFuncExpr
Auto Trait Implementations§
impl Freeze for AsyncFuncExpr
impl !RefUnwindSafe for AsyncFuncExpr
impl Send for AsyncFuncExpr
impl Sync for AsyncFuncExpr
impl Unpin for AsyncFuncExpr
impl !UnwindSafe for AsyncFuncExpr
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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