Struct datafusion_expr::expr_fn::SimpleScalarUDF
source · pub struct SimpleScalarUDF { /* private fields */ }
Expand description
Implements ScalarUDFImpl
for functions that have a single signature and
return type.
Implementations§
source§impl SimpleScalarUDF
impl SimpleScalarUDF
sourcepub fn new(
name: impl Into<String>,
input_types: Vec<DataType>,
return_type: DataType,
volatility: Volatility,
fun: ScalarFunctionImplementation,
) -> Self
pub fn new( name: impl Into<String>, input_types: Vec<DataType>, return_type: DataType, volatility: Volatility, fun: ScalarFunctionImplementation, ) -> Self
Create a new SimpleScalarUDF
from a name, input types, return type and
implementation. Implementing ScalarUDFImpl
allows more flexibility
Trait Implementations§
source§impl Debug for SimpleScalarUDF
impl Debug for SimpleScalarUDF
source§impl ScalarUDFImpl for SimpleScalarUDF
impl ScalarUDFImpl for SimpleScalarUDF
source§fn signature(&self) -> &Signature
fn signature(&self) -> &Signature
Returns the function’s
Signature
for information about what input
types are accepted and the function’s Volatility.source§fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue>
fn invoke(&self, args: &[ColumnarValue]) -> Result<ColumnarValue>
Invoke the function on
args
, returning the appropriate result Read moresource§fn display_name(&self, args: &[Expr]) -> Result<String>
fn display_name(&self, args: &[Expr]) -> Result<String>
Returns the user-defined display name of the UDF given the arguments
source§fn return_type_from_exprs(
&self,
_args: &[Expr],
_schema: &dyn ExprSchema,
arg_types: &[DataType],
) -> Result<DataType>
fn return_type_from_exprs( &self, _args: &[Expr], _schema: &dyn ExprSchema, arg_types: &[DataType], ) -> Result<DataType>
source§fn invoke_no_args(&self, _number_rows: usize) -> Result<ColumnarValue>
fn invoke_no_args(&self, _number_rows: usize) -> Result<ColumnarValue>
Invoke the function without
args
, instead the number of rows are provided,
returning the appropriate result.source§fn aliases(&self) -> &[String]
fn aliases(&self) -> &[String]
Returns any aliases (alternate names) for this function. Read more
source§fn simplify(
&self,
args: Vec<Expr>,
_info: &dyn SimplifyInfo,
) -> Result<ExprSimplifyResult>
fn simplify( &self, args: Vec<Expr>, _info: &dyn SimplifyInfo, ) -> Result<ExprSimplifyResult>
Optionally apply per-UDF simplification / rewrite rules. Read more
source§fn short_circuits(&self) -> bool
fn short_circuits(&self) -> bool
Returns true if some of this
exprs
subexpressions may not be evaluated
and thus any side effects (like divide by zero) may not be encountered
Setting this to true prevents certain optimizations such as common subexpression eliminationsource§fn evaluate_bounds(&self, _input: &[&Interval]) -> Result<Interval>
fn evaluate_bounds(&self, _input: &[&Interval]) -> Result<Interval>
Computes the output interval for a
ScalarUDFImpl
, given the input
intervals. Read moresource§fn propagate_constraints(
&self,
_interval: &Interval,
_inputs: &[&Interval],
) -> Result<Option<Vec<Interval>>>
fn propagate_constraints( &self, _interval: &Interval, _inputs: &[&Interval], ) -> Result<Option<Vec<Interval>>>
Updates bounds for child expressions, given a known interval for this
function. This is used to propagate constraints down through an expression
tree. Read more
source§fn output_ordering(&self, _inputs: &[ExprProperties]) -> Result<SortProperties>
fn output_ordering(&self, _inputs: &[ExprProperties]) -> Result<SortProperties>
Calculates the
SortProperties
of this function based on its
children’s properties.source§fn coerce_types(&self, _arg_types: &[DataType]) -> Result<Vec<DataType>>
fn coerce_types(&self, _arg_types: &[DataType]) -> Result<Vec<DataType>>
Coerce arguments of a function call to types that the function can evaluate. Read more
source§fn equals(&self, other: &dyn ScalarUDFImpl) -> bool
fn equals(&self, other: &dyn ScalarUDFImpl) -> bool
Return true if this scalar UDF is equal to the other. Read more
source§fn hash_value(&self) -> u64
fn hash_value(&self) -> u64
Returns a hash value for this scalar UDF. Read more
Auto Trait Implementations§
impl Freeze for SimpleScalarUDF
impl !RefUnwindSafe for SimpleScalarUDF
impl Send for SimpleScalarUDF
impl Sync for SimpleScalarUDF
impl Unpin for SimpleScalarUDF
impl !UnwindSafe for SimpleScalarUDF
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