Scalar function
Returns NULL for a NULL array. At most one NULL element remains.
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 or STRUCT.
Returns
- Type: ARRAY<T>
- Possible values: The distinct input values.
- NULL behavior: Returns NULL for a NULL array. At most one NULL element remains.
- Shape: Zero through the original number of elements.
- Ordering: First-occurrence encounter order.
Properties
Usage notes
- When removing duplicates, all NaN values are treated as equal, as are positive and negative zero.
- 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
Remove repeated strings
Limitations
- Elements must be comparable. MAP elements are not supported, including maps nested inside other elements.
- MAP elements, including MAP values nested inside compared elements, are outside the supported element types.
Last modified on October 15, 2026