File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ use crate::{
46
46
/// 2. For advanced use cases, use [`ScalarUDFImpl`] which provides full API
47
47
/// access (examples in [`advanced_udf.rs`]).
48
48
///
49
+ /// See [`Self::call`] to invoke a `ScalarUDF` with arguments.
50
+ ///
49
51
/// # API Note
50
52
///
51
53
/// This is a separate struct from `ScalarUDFImpl` to maintain backwards
@@ -121,7 +123,16 @@ impl ScalarUDF {
121
123
/// Returns a [`Expr`] logical expression to call this UDF with specified
122
124
/// arguments.
123
125
///
124
- /// This utility allows using the UDF without requiring access to the registry.
126
+ /// This utility allows easily calling UDFs
127
+ ///
128
+ /// # Example
129
+ /// ```no_run
130
+ /// use datafusion_expr::{col, lit, ScalarUDF};
131
+ /// # fn my_udf() -> ScalarUDF { unimplemented!() }
132
+ /// let my_func: ScalarUDF = my_udf();
133
+ /// // Create an expr for `my_func(a, 12.3)`
134
+ /// let expr = my_func.call(vec![col("a"), lit(12.3)]);
135
+ /// ```
125
136
pub fn call ( & self , args : Vec < Expr > ) -> Expr {
126
137
Expr :: ScalarFunction ( crate :: expr:: ScalarFunction :: new_udf (
127
138
Arc :: new ( self . clone ( ) ) ,
You can’t perform that action at this time.
0 commit comments