From 1b14655148377fac317153b5b5f14f4256a5d375 Mon Sep 17 00:00:00 2001 From: Jonathan Chen Date: Thu, 24 Oct 2024 14:41:39 -0400 Subject: [PATCH] changed doc instance (#13097) --- datafusion/functions-nested/src/range.rs | 4 ++- .../user-guide/sql/scalar_functions_new.md | 29 +++++++------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/datafusion/functions-nested/src/range.rs b/datafusion/functions-nested/src/range.rs index 2346b4d5b43f..ddc56b1e4ee8 100644 --- a/datafusion/functions-nested/src/range.rs +++ b/datafusion/functions-nested/src/range.rs @@ -283,8 +283,10 @@ impl ScalarUDFImpl for GenSeries { } } +static GENERATE_SERIES_DOCUMENTATION: OnceLock = OnceLock::new(); + fn get_generate_series_doc() -> &'static Documentation { - DOCUMENTATION.get_or_init(|| { + GENERATE_SERIES_DOCUMENTATION.get_or_init(|| { Documentation::builder() .with_doc_section(DOC_SECTION_ARRAY) .with_description( diff --git a/docs/source/user-guide/sql/scalar_functions_new.md b/docs/source/user-guide/sql/scalar_functions_new.md index 55e61984d7f8..c15821ac89a3 100644 --- a/docs/source/user-guide/sql/scalar_functions_new.md +++ b/docs/source/user-guide/sql/scalar_functions_new.md @@ -3530,34 +3530,27 @@ flatten(array) ### `generate_series` -Returns an Arrow array between start and stop with step. The range start..end contains all values with start <= x < end. It is empty if start >= end. Step cannot be 0. +Similar to the range function, but it includes the upper bound. ``` -range(start, stop, step) +generate_series(start, stop, step) ``` #### Arguments -- **start**: Start of the range. Ints, timestamps, dates or string types that can be coerced to Date32 are supported. -- **end**: End of the range (not included). Type must be the same as start. -- **step**: Increase by step (cannot be 0). Steps less than a day are supported only for timestamp ranges. +- **start**: start of the series. Ints, timestamps, dates or string types that can be coerced to Date32 are supported. +- **end**: end of the series (included). Type must be the same as start. +- **step**: increase by step (can not be 0). Steps less than a day are supported only for timestamp ranges. #### Example ```sql -> select range(2, 10, 3); -+-----------------------------------+ -| range(Int64(2),Int64(10),Int64(3))| -+-----------------------------------+ -| [2, 5, 8] | -+-----------------------------------+ - -> select range(DATE '1992-09-01', DATE '1993-03-01', INTERVAL '1' MONTH); -+--------------------------------------------------------------+ -| range(DATE '1992-09-01', DATE '1993-03-01', INTERVAL '1' MONTH) | -+--------------------------------------------------------------+ -| [1992-09-01, 1992-10-01, 1992-11-01, 1992-12-01, 1993-01-01, 1993-02-01] | -+--------------------------------------------------------------+ +> select generate_series(1,3); ++------------------------------------+ +| generate_series(Int64(1),Int64(3)) | ++------------------------------------+ +| [1, 2, 3] | ++------------------------------------+ ``` ### `list_any_value`