From e67302679de64f5c270932f0e07777db8deefda5 Mon Sep 17 00:00:00 2001 From: NoeB Date: Mon, 11 Nov 2024 17:33:50 +0100 Subject: [PATCH] minor(docs): Correct array_prepend docs --- docs/source/user-guide/expressions.md | 2 +- docs/source/user-guide/sql/scalar_functions.md | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/source/user-guide/expressions.md b/docs/source/user-guide/expressions.md index ababb001f5c5..03ab86eeb813 100644 --- a/docs/source/user-guide/expressions.md +++ b/docs/source/user-guide/expressions.md @@ -228,7 +228,7 @@ select log(-1), log(0), sqrt(-1); | array_pop_back(array) | Returns the array without the last element. `array_pop_back([1, 2, 3]) -> [1, 2]` | | array_position(array, element) | Searches for an element in the array, returns first occurrence. `array_position([1, 2, 2, 3, 4], 2) -> 2` | | array_positions(array, element) | Searches for an element in the array, returns all occurrences. `array_positions([1, 2, 2, 3, 4], 2) -> [2, 3]` | -| array_prepend(array, element) | Prepends an element to the beginning of an array. `array_prepend(1, [2, 3, 4]) -> [1, 2, 3, 4]` | +| array_prepend(element, array) | Prepends an element to the beginning of an array. `array_prepend(1, [2, 3, 4]) -> [1, 2, 3, 4]` | | array_repeat(element, count) | Returns an array containing element `count` times. `array_repeat(1, 3) -> [1, 1, 1]` | | array_remove(array, element) | Removes the first element from the array equal to the given value. `array_remove([1, 2, 2, 3, 2, 1, 4], 2) -> [1, 2, 3, 2, 1, 4]` | | array_remove_n(array, element, max) | Removes the first `max` elements from the array equal to the given value. `array_remove_n([1, 2, 2, 3, 2, 1, 4], 2, 2) -> [1, 3, 2, 1, 4]` | diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md index 232efb02d423..a51cf221acbc 100644 --- a/docs/source/user-guide/sql/scalar_functions.md +++ b/docs/source/user-guide/sql/scalar_functions.md @@ -3081,23 +3081,24 @@ array_position(array, element, index) ### `array_prepend` -Appends an element to the end of an array. +Prepends an element to the beginning of an array. ``` -array_append(array, element) +array_prepend(element, array) ``` #### Arguments -- **array**: Array expression. Can be a constant, column, or function, and any combination of array operators. - **element**: Element to append to the array. +- **array**: Array expression. Can be a constant, column, or function, and any combination of array operators. + #### Example ```sql -> select array_append([1, 2, 3], 4); +> select array_prepend(1, [2, 3, 4]); +--------------------------------------+ -| array_append(List([1,2,3]),Int64(4)) | +| array_prepend(Int64(1), List([2,3,4])) | +--------------------------------------+ | [1, 2, 3, 4] | +--------------------------------------+