ARRAY_REPEAT
Descriptionβ
Generates an array containing n repeated elements
Syntaxβ
ARRAY_REPEAT(<element>, <n>)
Parametersβ
Parameter | Description |
---|---|
<n> | Number of digits |
<element> | Specifying Elements |
Return Valueβ
Returns an array containing n repeated elements. array_with_constant has the same function as array_repeat and is used to be compatible with the hive syntax format.
Exampleβ
SELECT ARRAY_REPEAT("hello", 2),ARRAY_REPEAT(12345, 3);
+--------------------------+------------------------+
| array_repeat('hello', 2) | array_repeat(12345, 3) |
+--------------------------+------------------------+
| ["hello", "hello"] | [12345, 12345, 12345] |
+--------------------------+------------------------+