groupArrayInsertAt
Inserts a value into the array at the specified position.
Syntax
If in one query several values are inserted into the same position, the function behaves in the following ways:
- If a query is executed in a single thread, the first one of the inserted values is used.
- If a query is executed in multiple threads, the resulting value is an undetermined one of the inserted values.
Arguments
x— Value to be inserted. Expression resulting in one of the supported data types.pos— Position at which the specified elementxis to be inserted. Index numbering in the array starts from zero. UInt32.default_x— Default value for substituting in empty positions. Optional parameter. Expression resulting in the data type configured for thexparameter. Ifdefault_xis not defined, the default values are used.size— Length of the resulting array. Optional parameter. When using this parameter, the default valuedefault_xmust be specified. UInt32.
Returned value
- Array with inserted values.
Type: Array.
Example
Query:
Result:
Query:
Result:
Query:
Result:
Multi-threaded insertion of elements into one position.
Query:
As a result of this query you get random integer in the [0,9] range. For example: