Skip to content

Commit

Permalink
changed doc instance (#13097)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanc-n authored Oct 24, 2024
1 parent 631408b commit 1b14655
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
4 changes: 3 additions & 1 deletion datafusion/functions-nested/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ impl ScalarUDFImpl for GenSeries {
}
}

static GENERATE_SERIES_DOCUMENTATION: OnceLock<Documentation> = 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(
Expand Down
29 changes: 11 additions & 18 deletions docs/source/user-guide/sql/scalar_functions_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 1b14655

Please sign in to comment.