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: BOOLEAN
- Possible values: TRUE on a match; FALSE only when a non-NULL search finds no match and the array has no NULL element.
- NULL behavior: Returns NULL for NULL array or NULL search element. If no match is found but the array contains a NULL element, returns NULL.
Properties
Usage notes
- The array elements and search value are converted to a common type before comparison.
- 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
The array contains 2, so the result is TRUE.
If there is no match and the array contains NULL, the result is NULL, as shown next.