Scalar function
Returns NULL for NULL inputs, a NULL selected element, negative index, or an index beyond the end.
Syntax
Scalar
Arguments
Type notation used below:
- T is the array element type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.
Returns
- Type: T
- Possible values: The selected element.
- NULL behavior: Returns NULL for NULL inputs, a NULL selected element, negative index, or an index beyond the end.
Properties
Usage notes
- INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
Examples
Typical behavior
Access a string array
Last modified on October 15, 2026