pub trait Function:
Display
+ Sync
+ Send {
// Required methods
fn name(&self) -> &str;
fn return_type(&self, input_types: &[DataType]) -> Result<DataType>;
fn signature(&self) -> Signature;
// Provided methods
fn invoke_with_args(
&self,
args: ScalarFunctionArgs,
) -> Result<ColumnarValue> { ... }
fn eval(&self, _: &FunctionContext, _: &[VectorRef]) -> Result<VectorRef> { ... }
fn aliases(&self) -> &[String] { ... }
}
Expand description
Scalar function trait, modified from databend to adapt datafusion TODO(dennis): optimize function by it’s features such as monotonicity etc.
Required Methods§
Sourcefn return_type(&self, input_types: &[DataType]) -> Result<DataType>
fn return_type(&self, input_types: &[DataType]) -> Result<DataType>
The returned data type of function execution.
Provided Methods§
fn invoke_with_args(&self, args: ScalarFunctionArgs) -> Result<ColumnarValue>
Sourcefn eval(&self, _: &FunctionContext, _: &[VectorRef]) -> Result<VectorRef>
fn eval(&self, _: &FunctionContext, _: &[VectorRef]) -> Result<VectorRef>
Evaluate the function, e.g. run/execute the function.
TODO(LFC): Remove eval
when all UDFs are rewritten to invoke_with_args