From e24a5dd5a508ba605686206c853c914a2d0cc095 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 14 Aug 2024 19:59:28 -0400 Subject: [PATCH] Improve function documentation (#11996) --- datafusion/functions/src/core/mod.rs | 8 ++++++++ datafusion/functions/src/crypto/mod.rs | 1 + datafusion/functions/src/datetime/mod.rs | 2 +- datafusion/functions/src/encoding/mod.rs | 1 + datafusion/functions/src/math/mod.rs | 1 + datafusion/functions/src/regex/mod.rs | 2 +- datafusion/functions/src/string/mod.rs | 2 +- datafusion/functions/src/unicode/mod.rs | 2 +- 8 files changed, 15 insertions(+), 4 deletions(-) diff --git a/datafusion/functions/src/core/mod.rs b/datafusion/functions/src/core/mod.rs index 062a4a104d54..af340930eabc 100644 --- a/datafusion/functions/src/core/mod.rs +++ b/datafusion/functions/src/core/mod.rs @@ -86,6 +86,7 @@ pub mod expr_fn { } } +/// Returns all DataFusion functions defined in this package pub fn functions() -> Vec> { vec![ nullif(), @@ -94,6 +95,13 @@ pub fn functions() -> Vec> { nvl2(), arrow_typeof(), named_struct(), + // Note: most users invoke `get_field` indirectly via field access + // syntax like `my_struct_col['field_name']`, which results in a call to + // `get_field(my_struct_col, "field_name")`. + // + // However, it is also exposed directly for use cases such as + // serializing / deserializing plans with the field access desugared to + // calls to `get_field` get_field(), coalesce(), ] diff --git a/datafusion/functions/src/crypto/mod.rs b/datafusion/functions/src/crypto/mod.rs index 497c1af62a72..46177fc22b60 100644 --- a/datafusion/functions/src/crypto/mod.rs +++ b/datafusion/functions/src/crypto/mod.rs @@ -62,6 +62,7 @@ pub mod expr_fn { )); } +/// Returns all DataFusion functions defined in this package pub fn functions() -> Vec> { vec![digest(), md5(), sha224(), sha256(), sha384(), sha512()] } diff --git a/datafusion/functions/src/datetime/mod.rs b/datafusion/functions/src/datetime/mod.rs index a7e9827d6ca6..db4e365267dd 100644 --- a/datafusion/functions/src/datetime/mod.rs +++ b/datafusion/functions/src/datetime/mod.rs @@ -272,7 +272,7 @@ pub mod expr_fn { } } -/// Return a list of all functions in this package +/// Returns all DataFusion functions defined in this package pub fn functions() -> Vec> { vec![ current_date(), diff --git a/datafusion/functions/src/encoding/mod.rs b/datafusion/functions/src/encoding/mod.rs index 24e11e5d635f..48171370ad58 100644 --- a/datafusion/functions/src/encoding/mod.rs +++ b/datafusion/functions/src/encoding/mod.rs @@ -37,6 +37,7 @@ pub mod expr_fn { )); } +/// Returns all DataFusion functions defined in this package pub fn functions() -> Vec> { vec![encode(), decode()] } diff --git a/datafusion/functions/src/math/mod.rs b/datafusion/functions/src/math/mod.rs index 1e41fff289a4..b221fb900cfa 100644 --- a/datafusion/functions/src/math/mod.rs +++ b/datafusion/functions/src/math/mod.rs @@ -276,6 +276,7 @@ pub mod expr_fn { ); } +/// Returns all DataFusion functions defined in this package pub fn functions() -> Vec> { vec![ abs(), diff --git a/datafusion/functions/src/regex/mod.rs b/datafusion/functions/src/regex/mod.rs index 884db24d9ec8..4ac162290ddb 100644 --- a/datafusion/functions/src/regex/mod.rs +++ b/datafusion/functions/src/regex/mod.rs @@ -65,7 +65,7 @@ pub mod expr_fn { } } -#[doc = r" Return a list of all functions in this package"] +/// Returns all DataFusion functions defined in this package pub fn functions() -> Vec> { vec![regexp_match(), regexp_like(), regexp_replace()] } diff --git a/datafusion/functions/src/string/mod.rs b/datafusion/functions/src/string/mod.rs index 9a19151a85e2..622802f0142b 100644 --- a/datafusion/functions/src/string/mod.rs +++ b/datafusion/functions/src/string/mod.rs @@ -167,7 +167,7 @@ pub mod expr_fn { } } -/// Return a list of all functions in this package +/// Returns all DataFusion functions defined in this package pub fn functions() -> Vec> { vec![ ascii(), diff --git a/datafusion/functions/src/unicode/mod.rs b/datafusion/functions/src/unicode/mod.rs index 9e8c07cd36ed..40915bc9efde 100644 --- a/datafusion/functions/src/unicode/mod.rs +++ b/datafusion/functions/src/unicode/mod.rs @@ -125,7 +125,7 @@ pub mod expr_fn { } } -/// Return a list of all functions in this package +/// Returns all DataFusion functions defined in this package pub fn functions() -> Vec> { vec![ character_length(),