MCPcopy Create free account
hub / github.com/apache/datafusion / create_udf

Function create_udf

datafusion/expr/src/expr_fn.rs:408–422  ·  view source on GitHub ↗

Convenience method to create a new user defined scalar function (UDF) with a specific signature and specific return type. Note this function does not expose all available features of [`ScalarUDF`], such as computing return types based on input types multiple [`Signature`]s aliases See [`ScalarUDF`] for details and examples on how to use the full functionality.

(
    name: &str,
    input_types: Vec<DataType>,
    return_type: DataType,
    volatility: Volatility,
    fun: ScalarFunctionImplementation,
)

Source from the content-addressed store, hash-verified

406/// See [`ScalarUDF`] for details and examples on how to use the full
407/// functionality.
408pub fn create_udf(
409 name: &str,
410 input_types: Vec<DataType>,
411 return_type: DataType,
412 volatility: Volatility,
413 fun: ScalarFunctionImplementation,
414) -> ScalarUDF {
415 ScalarUDF::from(SimpleScalarUDF::new(
416 name,
417 input_types,
418 return_type,
419 volatility,
420 fun,
421 ))
422}
423
424/// Implements [`ScalarUDFImpl`] for functions that have a single signature and
425/// return type.

Callers 14

simple_udfFunction · 0.85
make_scalar_func_exprFunction · 0.85
roundtrip_scalar_udfFunction · 0.85
dummy_udfFunction · 0.85
context_with_udfFunction · 0.85
registryFunction · 0.85
make_udf_addFunction · 0.85
scalar_udfFunction · 0.85

Calls 1

newFunction · 0.85

Tested by 12

roundtrip_scalar_udfFunction · 0.68
dummy_udfFunction · 0.68
context_with_udfFunction · 0.68
registryFunction · 0.68
make_udf_addFunction · 0.68
scalar_udfFunction · 0.68
create_udf_contextFunction · 0.68
create_example_udfFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…