Working with Arrays
An Array is an ordered collection of zero or more VARCHAR
values.
Actions
Construct
Accessing
Testing
ANY
The ANY
function is used to apply a filter to each item in an array, and returns True
if any item in the array matches the condition.
ANY
supports the following operators: =
, !=
, >
, <
, >=
, and <=
.
ALL
The ALL
function is used to apply a filter to each item in an array, and returns True
if all items in the array matches the condition.
Note
ALL
currently supports a subset of operators: =
, !=
.
SEARCH
IN
The IN
operator allows a column to be tested against a list of values.
IN UNNEST
The combination of IN UNNEST
allows a value to be tested for containment in a column.
Accessors
Transforms
Converting Lists to Relations
Using UNNEST
UNNEST
allows you to create a single column table either as a list of literals, or from a column of LIST type in a dataset.
Limitations
Lists have the following limitations
- Statements cannot
ORDER BY
a list column - Statements cannot contain
DISTINCT
andJOIN
when the relations include list columns - Lists cannot be used in comparisons
Note
Some restrictions may be resolved by the query optimizer, for example, Projection Pushdown may remove list columns as part of optimization. However, you should not rely on the optimizer to take any particular action.