From 3ce1802df5a5ce716d911bf51fc774c0c714b438 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 19 Dec 2023 06:29:27 -0500 Subject: [PATCH] Improve docs for aliases --- datafusion/expr/src/udf.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/datafusion/expr/src/udf.rs b/datafusion/expr/src/udf.rs index f780dc9ea75a..2ec80a4a9ea1 100644 --- a/datafusion/expr/src/udf.rs +++ b/datafusion/expr/src/udf.rs @@ -279,8 +279,15 @@ pub trait ScalarUDFImpl { /// and treating all arguments as arrays will work, but will be slower. fn invoke(&self, args: &[ColumnarValue]) -> Result; - /// Returns any aliases (alternate names) for this function. This should not - /// include the value of [`Self::name`]. Defaults to `[]` (no aliases) + /// Returns any aliases (alternate names) for this function. + /// + /// Aliases can be used to invoke the same function using different names. + /// For example in some databases `now()` and `current_timestamp()` are + /// aliases for the same function. This behavior can be obtained by + /// returning `current_timestamp` as an alias for the `now` function. + /// + /// Note: `aliases` should only include names other than [`Self::name`]. + /// Defaults to `[]` (no aliases) fn aliases(&self) -> &[String] { &[] }