Skip to content

Commit

Permalink
fix: import doc and macro, fix typo and update function docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheng-Yuan-Lai committed Dec 29, 2024
1 parent 283c5ed commit a65039b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 2 additions & 0 deletions datafusion-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions datafusion/functions-nested/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ arrow-buffer = { workspace = true }
arrow-ord = { workspace = true }
arrow-schema = { workspace = true }
datafusion-common = { workspace = true }
datafusion-doc = { workspace = true }
datafusion-execution = { workspace = true }
datafusion-expr = { workspace = true }
datafusion-functions = { workspace = true }
datafusion-functions-aggregate = { workspace = true }
datafusion-macros = { workspace = true }
datafusion-physical-expr-common = { workspace = true }
itertools = { workspace = true, features = ["use_std"] }
log = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-nested/src/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ make_udf_expr_and_func!(
name = "array",
description = "Array expression. Can be a constant, column, or function, and any combination of array operators."
),
argument(name = "dimension", description = "Array dimension")
argument(name = "dimension", description = "Array dimension.")
)]
#[derive(Debug)]
pub struct ArrayLength {
Expand Down
24 changes: 8 additions & 16 deletions docs/source/user-guide/sql/scalar_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3119,34 +3119,26 @@ array_position(array, element, index)

### `array_positions`

Returns the position of the first occurrence of the specified element in the array.
Searches for an element in the array, returns all occurrences.

```
array_position(array, element)
array_position(array, element, index)
array_positions(array, element)
```

#### Arguments

- **array**: Array expression. Can be a constant, column, or function, and any combination of array operators.
- **element**: Element to search for position in the array.
- **index**: Index at which to start searching.

#### Example

```sql
> select array_position([1, 2, 2, 3, 1, 4], 2);
+----------------------------------------------+
| array_position(List([1,2,2,3,1,4]),Int64(2)) |
+----------------------------------------------+
| 2 |
+----------------------------------------------+
> select array_position([1, 2, 2, 3, 1, 4], 2, 3);
+----------------------------------------------------+
| array_position(List([1,2,2,3,1,4]),Int64(2), Int64(3)) |
+----------------------------------------------------+
| 3 |
+----------------------------------------------------+
> select array_positions([1, 2, 2, 3, 1, 4], 2);
+-----------------------------------------------+
| array_positions(List([1,2,2,3,1,4]),Int64(2)) |
+-----------------------------------------------+
| [2, 3] |
+-----------------------------------------------+
```

#### Aliases
Expand Down

0 comments on commit a65039b

Please sign in to comment.