All functions > ARRAY
All functions in the ARRAY category.
Backend availability
DD Available DD Partially available DD Not available DD DuckDB · PG Postgres · CH ClickHouse · TR Trino · BQ BigQuery · SF Snowflake · DB Databricks · SV Serving
Element Access
| Function | Description | Backends |
|---|
ELEMENT_AT_POS() | Returns the element at the specified position in an array. | DD | PG | CH | TR | BQ | SF | DB | SV |
ELEMENTS_AT_POS() | Returns the elements at multiple specified positions in an array. | DD | PG | CH | TR | BQ | SF | DB | SV |
SLICE_LEN() | Returns a slice of an array using start:length:step semantics. | DD | PG | CH | TR | BQ | SF | DB | SV |
SLICE_END() | Returns the slice of an array or a string from a start index to an end index (inclusive). | DD | PG | CH | TR | BQ | SF | DB | SV |
Search And Lookup
| Function | Description | Backends |
|---|
CONTAINS() | Returns TRUE if the array contains the specified element. | DD | PG | CH | TR | BQ | SF | DB | SV |
CONTAINS_SEQUENCE() | Returns TRUE if the array contains the specified sequence as a contiguous subsequence. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_POSITION() | Returns the 1-based position of the first occurrence of an element in an array. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_LOOKUP(...) | Returns the value corresponding to a lookup key using parallel key-value arrays. | DD | PG | CH | TR | BQ | SF | DB | SV |
Filtering And Transformation
| Function | Description | Backends |
|---|
ARRAY_SORT() | Returns the sorted version of an array. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_REVERSE() | Returns the reverse of an array. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_ENUMERATE() | Returns an array of rows pairing each 1-based position with the corresponding element. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_ENUMERATE_FLATTEN() | Returns an array of rows pairing each 1-based position with the flattened fields of the... | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_ROTATE() | Returns a new array whose elements are rotated circularly; positive amounts shift left, negative... | DD | PG | CH | TR | BQ | SF | DB | SV |
NGRAMS() | Returns adjacent n-element sub-sequences (n-grams) sliding across the input array. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_DISTINCT() | Returns an array with distinct elements, in order of first occurrence. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_REMOVE() | Returns an array with all occurrences of the specified element removed. | DD | PG | CH | TR | BQ | SF | DB | SV |
FLATTEN() | Flattens a nested array structure into a single-level array. | DD | PG | CH | TR | BQ | SF | DB | SV |
Set Operations
| Function | Description | Backends |
|---|
ARRAY_UNION() | Returns the union of two arrays, keeping the first occurrence of each element. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_INTERSECT() | Returns the intersection of two arrays using set semantics. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_EXCEPT() | Returns the difference of two arrays using set semantics. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAYS_OVERLAP() | Returns TRUE if any elements are common between the two arrays. | DD | PG | CH | TR | BQ | SF | DB | SV |
Aggregation And Statistics
| Function | Description | Backends |
|---|
ARRAY_COUNT() | Returns the number of elements in an array. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_SUM() | Returns the sum of all numeric elements in an array. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_PRODUCT() | Returns the product of all numeric elements in an array as a DOUBLE. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_MEDIAN() | Returns the statistical median of numeric array elements as a DOUBLE. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_STDDEV_POP() | Returns the population standard deviation (divide by N) of numeric array elements as a DOUBLE. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_STDDEV_SAMP() | Returns the sample standard deviation (divide by N-1) of numeric array elements as a DOUBLE. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_VAR_POP() | Returns the population variance (divide by N) of numeric array elements as a DOUBLE. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_VAR_SAMP() | Returns the sample variance (divide by N-1) of numeric array elements as a DOUBLE. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_AVG() | Returns the arithmetic mean (average) of all numeric elements in an array. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_MIN() | Returns the smallest value in an array using natural ordering. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_MAX() | Returns the largest value in an array using natural ordering. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_HISTOGRAM() | Returns a frequency histogram of values in an array as an array of value-count pairs. | DD | PG | CH | TR | BQ | SF | DB | SV |
Boolean Operations
| Function | Description | Backends |
|---|
ALL(...) | Returns TRUE if all elements in the boolean array are true. | DD | PG | CH | TR | BQ | SF | DB | SV |
ANY(...) | Returns TRUE if any element in the boolean array is true. | DD | PG | CH | TR | BQ | SF | DB | SV |
NONE(...) | Returns TRUE if no elements in the boolean array are true. | DD | PG | CH | TR | BQ | SF | DB | SV |
ARRAY_NOT() | Returns an array with inverted boolean values (logical NOT applied to each element). | DD | PG | CH | TR | BQ | SF | DB | SV |
Array Combination
| Function | Description | Backends |
|---|
ARRAY_CONCAT(...) | Concatenates multiple arrays into a single combined array with optional deduplication. | DD | PG | CH | TR | BQ | SF | DB | SV |
COMBINATIONS() | Returns all 2-element sub-groups of the input array as an array of 2-element arrays. | DD | PG | CH | TR | BQ | SF | DB | SV |
PERMUTATIONS() | Returns all ordered 2-element selections from the input array as an array of 2-element arrays. | DD | PG | CH | TR | BQ | SF | DB | SV |
Array Generation
| Function | Description | Backends |
|---|
REPEAT() | Creates an array by repeating an element a specified number of times. | DD | PG | CH | TR | BQ | SF | DB | SV |
SEQUENCE() | Generates an inclusive array from start to stop. Accepts integers with an optional step (default... | DD | PG | CH | TR | BQ | SF | DB | SV |
String Conversion
| Function | Description | Backends |
|---|
ARRAY_JOIN() | Joins the elements of an array into a single string using a specified delimiter. | DD | PG | CH | TR | BQ | SF | DB | SV |
Vector Operations
| Function | Description | Backends |
|---|
COSINE_SIMILARITY() | Calculates the cosine similarity between two arrays. | DD | PG | CH | TR | BQ | SF | DB | SV |
DOT_PRODUCT() | Calculates the dot product of two arrays. | DD | PG | CH | TR | BQ | SF | DB | SV |
EUCLIDEAN_DISTANCE() | Calculates the Euclidean distance between two arrays. | DD | PG | CH | TR | BQ | SF | DB | SV |
NORMALIZE() | Normalizes a numeric array by dividing each element by the sum of all elements. | DD | PG | CH | TR | BQ | SF | DB | SV |
Summary
Functions in this category: 47