InsertAt¶
Inserts a scalar value at the given 0-based index of an ARRAY, returning a new ARRAY.
InsertAt(N, value) inserts a scalar at position N of the input
array; existing elements at and after N shift one position right.
The index is clamped to [0, size]: negative values insert at the
front, indices beyond the end append at the back.
The pipeline must carry a single ARRAY-typed value; the rule
produces a new ARRAY of length size + 1.
Available in new mode only.
Parameters¶
- 1 —
indexMandatory — accepts: INT -
Insertion position. Clamped to
[0, size]— negative indices insert at the front, indices beyond the end append. - 2 —
valueMandatory — accepts: BOOLEAN, DATE, FLOAT, INT, STRING, NULL -
A scalar literal to insert.
ARRAYvalues and field references are not accepted.
Input type¶
ARRAY
Output type¶
ARRAY
Requires¶
- Exactly one ARRAY-typed pipeline input.
Examples¶
Insert a header element at the front (test095)
Append by passing the array's length
Errors¶
-
`InsertAt': input must be ARRAY-typed- The pipeline value reaching the rule is not an
ARRAY.
-
`InsertAt' requires two parameters: an integer index and a scalar value- Wrong arity, non-integer index, or non-scalar value.
-
`InsertAt' second parameter must be a scalar value- An
ARRAYliteral or unknown-type expression was used as the value parameter.
-
`InsertAt' is only available in new mode- New mode is not enabled in
etl.conf.