array_join
NULL array/delimiter return NULL. NULL elements are skipped unless non-NULL null_text is supplied.
Syntax
Scalar
With null text (scalar)
- The optional third argument is available only with ARRAY_JOIN.
Array join default (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 or ARRAY.
Scalar, array join default
With null text
Returns
- Type: STRING
- Possible values: Joined text.
- NULL behavior: NULL array/delimiter return NULL. NULL elements are skipped unless non-NULL null_text is supplied.
Scalar, With null text, Array join default
- Type: STRING
- Possible values: Joined text.
- NULL behavior: NULL array/delimiter return NULL. NULL elements are skipped unless non-NULL null_text is supplied.
Properties
Usage notes
- Nested arrays are traversed recursively.
- NULL replacement text behaves like an omitted replacement and skips NULL elements. Nested list elements are recursively joined in encounter order. Leaf types include strings, booleans, integers, FLOAT/DOUBLE and types convertible to STRING; other leaf types raise an error.
- 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
Join the values with a comma between them:
The following examples show how NULL elements are handled:
Alias calling form: ARRAY_JOIN
Limitations
- Pass an ARRAY as the first argument. Reported VARCHAR widths do not limit or truncate the returned text.
- MAP and STRUCT elements are not supported.