Array Functions
list_collect
Syntax | list_collect(ARG) |
---|---|
Parameter Description | The parameter involved in the calculation, optional types: any |
Return Type | Array |
Description | Aggregation function that collects the ARG parameter into an array. (The return format is of array type. If you find it displayed as null, you can try converting it to a string type to view it.) |
Example | list_collect({f1}), returns: an array containing all values of the f1 field |
list_collect_flatten
Syntax | list_collect_flatten(ARR) |
---|---|
Parameter | Array type parameter, optional type: Array |
Return Type | Array |
Description | Aggregation function that collects and flattens the arr parameter into an array. (The return format is of array type. If you find it displayed as null, you can try converting it to a string type to view it.) |
Example | list_collect_flatten({f1}), returns: Collects all elements of the f1 array and combines them into a new array. |
list_contains
Syntax | list_contains(ARR1, ARR2) |
---|---|
Parameters | 1. Array 1, optional type: array; 2. Array 2, optional type: array |
Return Type | Boolean |
Description | Determines whether arr1 contains all elements of arr2 |
Example | list_contains([1, 2, 3], [2, 3]), returns: TRUE |
list_count
Syntax | list_count(ARR) |
---|---|
Parameter | Array type parameter, optional type: Array |
Return Type | Number |
Description | Get the length of the array |
Example | list_count([1, 2, 3]), returns: 3 |
list_distinct
Syntax | list_distinct(ARR) |
---|---|
Parameter | Array type parameter, optional type: Array |
Return Type | Array |
Description | Removes duplicate elements from the array |
Example | list_distinct([1, 2, 2, 3]), returns: [1, 2, 3] |
list_elements
Syntax | list_elements(ARR) |
---|---|
Parameter | Array type parameter, optional type: Array |
Return Type | ANY |
Description | Splits all elements of the specified array into multiple rows |
Example | list_elements([1, 2, 3]), returns: 1, 2, 3 (displayed in separate rows) |
list_except
Syntax | list_except(ARR1, ARR2) |
---|---|
Parameters | 1. Array 1, optional type: array; 2. Array 2, optional type: array |
Return Type | Array |
Description | Returns the elements that exist in arr1 but do not exist in arr2 |
Example | list_except([1, 2, 3], [2, 4]), returns: [1, 3] |
list_get
Syntax | list_get(ARR, INDEX) |
---|---|
Parameters | 1. Array type parameter, optional type: Array; 2. Index position, optional type: Number |
Return Type | Any type |
Description | Retrieves the element at the specified position in the array |
Example | list_get([10, 20, 30], 1), returns: 20 (when the index starts from 0) |
list_in
Syntax | list_in(ARR, ARG) |
---|---|
Parameters | 1. Array type parameter, optional type: Array; 2. Value to be checked, optional type: Any type |
Return Type | Boolean |
Description | Determines whether the specified array contains the given arg value |
Example | list_in([1, 2, 3], 2), returns: TRUE |
list_intersect
Syntax | list_intersect(ARR1, ARR2) |
---|---|
Parameters | 1. Array 1, optional type: array; 2. Array 2, optional type: array |
Return Type | Array |
Description | Calculates the intersection of two arrays |
Example | list_intersect([1, 2, 3], [2, 3, 4]), returns: [2, 3] |
list_lower
Syntax | list_lower(ARR) |
---|---|
Parameter | Array type parameter, optional type: Array |
Return Type | NUMBER |
Description | Retrieves the lower bound of the specified array |
Example | list_lower([1, 2, 3]), returns: 1 (usually the lower bound of an array starts from 1) |
list_slice
Syntax | list_slice(ARR, ARG1, ARG2) |
---|---|
Parameters | 1. Array type parameter, optional type: Array; 2. Lower bound index, optional type: Number; 3. Upper bound index, optional type: Number |
Return Type | Array |
Description | Returns a slice of arr between the specified lower bound arg1 and upper bound arg2 |
Example | list_slice([1, 2, 3, 4], 1, 3), returns: [2, 3] |
list_union
Syntax | list_union(ARR1, ARR2) |
---|---|
Parameters | 1. Array 1, optional type: array; 2. Array 2, optional type: array |
Return Type | Array |
Description | Computes the union of two arrays |
Example | list_union([1, 2], [2, 3]), returns: [1, 2, 2, 3] |
list_upper
Syntax | list_upper(ARR) |
---|---|
Parameter | Array type parameter, optional type: Array |
Return Type | NUMBER |
Description | Retrieves the upper bound of the specified array |
Example | list_upper([1, 2, 3]), returns: 3 (typically the upper bound of an array is its length) |
set_collect
Syntax | set_collect(ARG) |
---|---|
Parameter | The parameter for calculation, optional types: any type |
Return Type | Array |
Description | Aggregation function that collects the arg parameter into a deduplicated array. (The return format is of array type. If you find it displayed as null, you can try converting it to a string type to view.) |
Example | set_collect([1, 2, 2, 3]), returns: [1, 2, 3] |
set_collect_flatten
Syntax | set_collect_flatten(ARR) |
---|---|
Parameter | Array type parameter, optional type: Array |
Return Type | Array |
Description | Aggregation function that collects and flattens the arr parameter into a deduplicated array. (The return format is of array type. If you find it displayed as null, you can try converting it to a string type for viewing.) |
Example | set_collect_flatten([[1, 2], [2, 3]]), returns: [1, 2, 3] |
set_union
Syntax | set_union(ARR1, ARR2) |
---|---|
Parameters | 1. Array 1, optional type: array; 2. Array 2, optional type: array |
Return Type | Array |
Description | Calculates the deduplicated union of two arrays |
Example | set_union([1, 2], [2, 3]), returns: [1, 2, 3] |
str_to_array
Syntax | str_to_array(ARG1, ARG2) |
---|---|
Parameters | 1. Text type parameter, optional type: STRING; 2. Separator, optional type: STRING |
Return Type | Array |
Description | Splits the text arg1 into an array using the separator arg2 |
Example | str_to_array('a,b,c', ','), returns: ["a", "b", "c"] |