Skip to content

Commit

Permalink
Release 2024.11 (#129)
Browse files Browse the repository at this point in the history
* Add upcoming release section

* Prepare the September 2024 release

* Update commit hash (missing character)

* Prepare for the Nov 2024 release

* Document additional array functions (#130)

---------

Co-authored-by: André Kohn <[email protected]>
Co-authored-by: Marcel Kost <[email protected]>
Co-authored-by: Adrian Vogelsgesang <[email protected]>
  • Loading branch information
4 people authored Nov 7, 2024
1 parent 674d456 commit 136f7c3
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 55 deletions.
6 changes: 6 additions & 0 deletions website/docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ In case you are wondering why all our releases start with `0.0`, read [this FAQ

:::

### 0.0.20746 [Nov 7 2024]

* Support for `array_contains`, `array_position` and `array_positions` was added
* Support for the `unnest` set-returning function was added
* Various performance and stability improvements

### 0.0.20027 [Aug 19 2024]

* Introduced new [`array` SQL datatypes](./sql/datatype/array.md).
Expand Down
5 changes: 4 additions & 1 deletion website/docs/sql/scalar_func/arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Signature|Description|Example
<code>array(T)**[**int**]**</code> → `T`| Returns the n-th element of the array (1-indexed). | `(array[1,2,3])[1]``1`
<code>array(T)**[**int**:**int**]**</code> → `T` | Returns the subarray within the given boundes (1-indexed, inclusive). |`(array[1,2,3])[2:3]``{2,3}` |
<code>**array_length(**array**)**</code> → `int` | Returns the length of the array. | `array_length(array[1,2,3])``3`
<code>**array_to_string(**array, text [, text]**)**</code>| Converts the array into a textual representation, with the given element separator and (optional) null indicator. | `array_to_string(array[1,2,3], ';')``1;2;3`<br/>`array_to_string(array[3,2,1,null], '⏰', '🎉')``3⏰2⏰1⏰🎉`
<code>**array_to_string(**array, text [, text]**)**</code>| Converts the array into a textual representation, with the given element separator and (optional) null indicator. | `array_to_string(array[1,2,3], ';')``1;2;3`<br/>`array_to_string(array[3,2,1,null], '⏰', '🎉')``3⏰2⏰1⏰🎉`
<code>**array_contains(**array, value**)**</code>| Checks if a given value is contained within the array. | `array_contains(array[1,3,4], 3)``true`<br/>`array_contains(array[1,3,4], 2)``false`
<code>**array_position(**array, value**)**</code>| Returns the index of the first occurrence of `value` inside `array`. Comparisons are done using `IS NOT DISTINCT FROM` semantics, so it is possible to search for `NULL`. Returns `NULL` if the element is not found. | `array_position(array[1,3,4,3], 3)``2`<br/>`array_contains(array[1,3,4,3], 2)``NULL`
<code>**array_positions(**array, value**)**</code>| Returns the an array containing the indices of all occurrences of `value` inside `array`. Comparisons are done using `IS NOT DISTINCT FROM` semantics, so it is possible to search for `NULL`. `NULL` is returned only if the array is `NULL`; if the value is not found in the array, an empty array is returned. | `array_positions(array[1,3,4,3], 3)``[2,4]`<br/>`array_contains(array[1,3,4,3], 2)``[]`

## Transformations
The following functions produce new array values from existing ones.
Expand Down
136 changes: 83 additions & 53 deletions website/docs/sql/setreturning.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,89 @@ This section describes functions that possibly return more than one row.
Set returning functions are usually used in SQL queries in the
[FROM clause](command/select#from).

## `generate_series`

Generate a series of values, from `start` to `stop` with a given `step` size

```sql_template
`generate_series(<start>, <stop> [, <step>])`
```

If `step` is not specified, the default step size of `1` will be used.
When `step` is positive, zero rows are returned if `start` is greater
than `stop`. Conversely, when `step` is negative, zero rows are returned
if `start` is less than `stop`. Zero rows are also returned for `NULL`
inputs. It is an error for `step` to be zero. Some examples follow:

SELECT * FROM generate_series(2,4);
generate_series
-----------------
2
3
4
(3 rows)

SELECT * FROM generate_series(5,1,-2);
generate_series
-----------------
5
3
1
(3 rows)

SELECT * FROM generate_series(4,3);
generate_series
-----------------
(0 rows)

SELECT generate_series(1.1, 4, 1.3);
generate_series
-----------------
1.1
2.4
3.7
(3 rows)

-- this example relies on the date-plus-integer operator
SELECT current_date + s.a AS dates FROM generate_series(0,14,7) AS s(a);
dates
------------
2004-02-05
2004-02-12
2004-02-19
(3 rows)

## `unnest` {#unnest}

The `unnest` function expands the elements from an array:

SELECT * FROM unnest(ARRAY['Mon','Tue','Wed','Thu','Fri'])
unnest
-----------------
Mon
Tue
Wed
Thu
Fri
(5 rows)

`unnest` can also be called with multiple array paramters (potentially of different data types). In this case, the arrays are expanded pairwise. If the arrays are not all the same length then the shorter ones are padded with NULLs.

SELECT * FROM unnest(
ARRAY['Mon','Tue','Wed','Thu','Fri'],
ARRAY[1,2,3,4,5,6,7]
) AS days(name, nr);
name | nr
------+----
Mon | 1
Tue | 2
Wed | 3
Thu | 4
Fri | 5
NULL | 6
NULL | 7
(7 rows)

## `external` {#external}

The `external` function reads data stored in an external file format
Expand Down Expand Up @@ -89,56 +172,3 @@ Same but with explicit Amazon S3 credentials and bucket region:
region => 'us-east-1'
)
) WHERE price > 100;

## `generate_series`

Generate a series of values, from `start` to `stop` with a given `step` size

```sql_template
`generate_series(<start>, <stop> [, <step>])`
```

If `step` is not specified, the default step size of `1` will be used.
When `step` is positive, zero rows are returned if `start` is greater
than `stop`. Conversely, when `step` is negative, zero rows are returned
if `start` is less than `stop`. Zero rows are also returned for `NULL`
inputs. It is an error for `step` to be zero. Some examples follow:

SELECT * FROM generate_series(2,4);
generate_series
-----------------
2
3
4
(3 rows)

SELECT * FROM generate_series(5,1,-2);
generate_series
-----------------
5
3
1
(3 rows)

SELECT * FROM generate_series(4,3);
generate_series
-----------------
(0 rows)

SELECT generate_series(1.1, 4, 1.3);
generate_series
-----------------
1.1
2.4
3.7
(3 rows)

-- this example relies on the date-plus-integer operator
SELECT current_date + s.a AS dates FROM generate_series(0,14,7) AS s(a);
dates
------------
2004-02-05
2004-02-12
2004-02-19
(3 rows)
2 changes: 1 addition & 1 deletion website/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const version_long = '0.0.20027.rcc745c2c';
const version_long = '0.0.20746.reac9bd2d';
const version_short = version_long.substr(0, version_long.lastIndexOf('.'));

const downloadBaseUrl = 'https://downloads.tableau.com/tssoftware/';
Expand Down

0 comments on commit 136f7c3

Please sign in to comment.