You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"x1", "Constant value of any type T. If only this argument is provided, the array will be of type T."},
302
+
{"[, x2, ..., xN]", "Additional N constant values sharing a common supertype with `x1`"},
303
+
};
304
+
FunctionDocumentation::ReturnedValue returned_value = "Returns an 'Array(T)' type result, where 'T' is the smallest common type out of the passed arguments.";
Gets the element of the provided array with index `n` where `n` can be any integer type.
2207
+
If the index falls outside of the bounds of an array, it returns a default value (0 for numbers, an empty string for strings, etc.),
2208
+
except for arguments of a non-constant array and a constant index 0. In this case there will be an error `Array indices are 1-based`.
2209
+
2210
+
:::note
2211
+
Arrays in ClickHouse are one-indexed.
2212
+
:::
2213
+
2214
+
Negative indexes are supported. In this case, the corresponding element is selected, numbered from the end. For example, `arr[-1]` is the last item in the array.
{"arr", "The array to search. [`Array(T)`](/sql-reference/data-types/array)."},
2221
+
{"n", "Position of the element to get. [`(U)Int*`](/sql-reference/data-types/int-uint)."}
2222
+
};
2223
+
FunctionDocumentation::ReturnedValue returned_value = "Returns a single combined array from the provided array arguments. [`Array(T)`](/sql-reference/data-types/array).";
2224
+
FunctionDocumentation::Examples examples = {
2225
+
{"Usage example", "SELECT arrayElement(arr, 2) FROM (SELECT [1, 2, 3] AS arr)", "2"},
2226
+
{"Negative indexing", "SELECT arrayElement(arr, -1) FROM (SELECT [1, 2, 3] AS arr)", "3"},
2227
+
{"Using [n] notation", "SELECT arr[2] FROM (SELECT [1, 2, 3] AS arr)", "2"},
2228
+
{"Index out of array bounds", "SELECT arrayElement(arr, 4) FROM (SELECT [1, 2, 3] AS arr)", "0"}
Gets the element of the provided array with index `n` where `n` can be any integer type.
2238
+
If the index falls outside of the bounds of an array, `NULL` is returned instead of a default value.
2239
+
2240
+
:::note
2241
+
Arrays in ClickHouse are one-indexed.
2242
+
:::
2208
2243
2209
2244
Negative indexes are supported. In this case, it selects the corresponding element numbered from the end. For example, `arr[-1]` is the last item in the array.
2210
-
2211
-
If the index falls outside of the bounds of an array, it returns some default value (0 for numbers, an empty string for strings, etc.), except for the case with a non-constant array and a constant index 0 (in this case there will be an error `Array indices are 1-based`).
Get the element with the index `n`from the array `arr`. `n` must be any integer type. Indexes in an array begin from one.
2217
-
2218
-
Negative indexes are supported. In this case, it selects the corresponding element numbered from the end. For example, `arr[-1]` is the last item in the array.
2219
-
2220
-
If the index falls outside of the bounds of an array, it returns `NULL` instead of a default value.
FunctionDocumentation::Arguments arguments = {{"x", "String, FixedString or Array for which to calculate the number of bytes (for String/FixedString) or elements (for Array)."}};
23
+
FunctionDocumentation::ReturnedValue returned_value = "Returns the number of number of bytes in the String/FixedString `x` / the number of elements in array `x`";
Returns an array of numbers from `start` to `end - 1` by `step`.
577
+
578
+
The supported types are:
579
+
- `UInt8/16/32/64`
580
+
- `Int8/16/32/64]`
581
+
582
+
- All arguments `start`, `end`, `step` must be one of the above supported types. Elements of the returned array will be a super type of the arguments.
583
+
- An exception is thrown if the function returns an array with a total length more than the number of elements specified by setting [`function_range_max_elements_in_block`](../../operations/settings/settings.md#function_range_max_elements_in_block).
584
+
- Returns `NULL` if any argument has Nullable(nothing) type. An exception is thrown if any argument has `NULL` value (Nullable(T) type).
585
+
)";
586
+
FunctionDocumentation::Syntax syntax = "range([start, ] end [, step])";
587
+
FunctionDocumentation::Arguments arguments = {
588
+
{"start", "Optional. The first element of the array. Required if `step` is used. Default value: `0`."},
589
+
{"end", "Required. The number before which the array is constructed."},
590
+
{"step", "Optional. Determines the incremental step between each element in the array. Default value: `1`."},};
591
+
FunctionDocumentation::ReturnedValue returned_value = "Array of numbers from `start` to `end - 1` by `step`.";
0 commit comments