mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-19 12:52:37 +00:00
Docs: Update example for indexOfAssumeSorted
This commit is contained in:
parent
3c7d675579
commit
372b2566a0
@ -770,7 +770,8 @@ i
|
||||
|
||||
## indexOf(arr, x)
|
||||
|
||||
Returns the index of the first ‘x’ element (starting from 1) if it is in the array, or 0 if it is not.
|
||||
Returns the index of the first element with value ‘x’ (starting from 1) if it is in the array.
|
||||
If the array does not contain the searched-for value, the function returns 0.
|
||||
|
||||
Example:
|
||||
|
||||
@ -788,9 +789,10 @@ Elements set to `NULL` are handled as normal values.
|
||||
|
||||
## indexOfAssumeSorted(arr, x)
|
||||
|
||||
Returns the index of the first ‘x’ element (starting from 1) if it is in the array, or 0 if it is not.
|
||||
The function should be used for an array sorted not in descending order since binary search is used for the search.
|
||||
If the internal array type is Nullable, the ‘indexOf‘ function will be used.
|
||||
If the array does not contain the searched-for value, the function returns 0.
|
||||
Returns the index of the first element with value ‘x’ (starting from 1).
|
||||
Assumes that the array is sorted in ascending order (the function uses binary search).
|
||||
If the internal array is of type Nullable, function ‘indexOf‘ will be called.
|
||||
|
||||
Example:
|
||||
|
||||
@ -799,9 +801,9 @@ SELECT indexOfAssumeSorted([1, 3, 3, 3, 4, 4, 5], 4)
|
||||
```
|
||||
|
||||
``` text
|
||||
┌─indexOf([1, 3, 3, 3, 4, 4, 5], NULL)─┐
|
||||
│ 5 │
|
||||
└──────────────────────────────────--─-┘
|
||||
┌─indexOfAssumeSorted([1, 3, 3, 3, 4, 4, 5], 4)─┐
|
||||
│ 5 │
|
||||
└───────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## arrayCount(\[func,\] arr1, ...)
|
||||
@ -3212,4 +3214,4 @@ Result:
|
||||
|
||||
## Distance functions
|
||||
|
||||
All supported functions are described in [distance functions documentation](../../sql-reference/functions/distance-functions.md).
|
||||
All supported functions are described in [distance functions documentation](../../sql-reference/functions/distance-functions.md).
|
||||
|
Loading…
Reference in New Issue
Block a user