Working with Arrays
An Array is an ordered collection of zero or more VARCHAR values.
Actions
Casting
Construct
Accessing
Testing
ANY (comparision)
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 <=.
ANY (similarity)
The ANY modifier is used to perform a similarity search against all of the items in an array for each item in an array, and returns True is any item in the array matches the pattern.
ANY supports the following operators: LIKE, NOT LIKE, ILIKE, NOT ILIKE
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 BYa list column - Statements cannot contain
DISTINCTandJOINwhen 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.