Skip to content

Apache DataFusion SQL Query Engine

minor(docs): Correct array_prepend docs (#13362)

NoeB382ba2b1605d
diff --git a/docs/source/user-guide/expressions.md b/docs/source/user-guide/expressions.md
index ababb001f5..03ab86eeb8 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 232efb02d4..490462909b 100644
--- a/docs/source/user-guide/sql/scalar_functions.md
+++ b/docs/source/user-guide/sql/scalar_functions.md
@@ -3081,23 +3081,23 @@ 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] |
+--------------------------------------+