Overview of array functions
Array functions are a set of specialized functions provided by the seekdb system for processing array data. These functions allow users to perform complex array queries and analyses.
Here is an overview of some array functions in seekdb and their purposes:
Types of array functions
| Type of array function | Description |
|---|---|
| Array constructor functions | Functions for constructing new array data types. |
| Array decision functions | Functions for performing logical judgments on input array data and returning boolean values. |
| Array output functions | Functions for outputting input array data and returning the output array data. |
| Array manipulation functions | Functions for performing basic operations on input array data, such as adding, deleting, and searching for elements, and returning the manipulated array data. |
Overview of all array functions
The following table lists all array functions supported by seekdb:
| Function type | Function name | Description |
|---|---|---|
| Array constructor function | array | Constructs an array data type. |
| Array constructor function | rb_build | Converts an array data type with an integer as its base type into an efficient compressed bitmap data type (RoaringBitmap). |
| Operator | [] | Constructs an array data type. |
| Array decision function | array_contains | Checks whether an element exists in an array. |
| Array decision function | array_contains_all | Checks whether an input array contains all elements of another array. |
| Array decision function | array_overlaps | Checks whether two arrays have an intersection. |
| Operator | ANY | Checks whether an element exists in an array, with the same functionality as the array_contains() function. |
| Array output function | array_to_string | Converts an array into a string. Specifically, it prints all base elements in the array into a string based on the specified separator and empty element symbol. |
| Array manipulation function | array_append | Adds a specified element to a target array. |
| Array manipulation function | array_distinct | Removes duplicate elements from a target array. |
| Array manipulation function | array_remove | Removes a specified element from a target array. |
| Array manipulation function | cardinality | Returns the number of base elements in a target array. |
| Array manipulation function | element_at | Returns an element at a specified position in a target array based on the index. |
| Array manipulation function | string_to_array | Splits a string into a string array based on a specified separator. |
| Array manipulation function | array_agg | Aggregates multiple rows of data on a specified column into one array value and returns the result. |
| Array manipulation function | unnest | Expands elements in an array into multiple rows and returns a relation table containing these elements. |
| Array manipulation function | array_prepend | Adds an element to the beginning of an array and returns a new array. |
| Array manipulation function | array_concat | Merges multiple arrays into one and returns a new array. |
| Array manipulation function | array_compact | Removes consecutive duplicate elements from an array and returns a new array. |
| Array manipulation function | array_sort | Sorts an array in ascending order and places NULL values at the end of the array during sorting. |
| Array manipulation function | array_length | Returns the length of an array. If the array is nested, it returns the length of the top-level array. |
| Array manipulation function | array_range | Generates an evenly spaced array. |
| Array manipulation function | array_sum | Calculates the sum of all elements in an array. |
| Array manipulation function | array_difference | Calculates the difference between two adjacent elements in an array and stores the result in a new array. |
| Array manipulation function | array_min | Returns the minimum value in an array, ignoring NULL values. |
| Array manipulation function | array_max | Returns the maximum value in an array, ignoring NULL values. |
| Array manipulation function | array_avg | Returns the average value of all elements in an array, treating NULL values as 0. |
| Array manipulation function | array_position | Finds the position of a specified element in an array. |
| Array manipulation function | array_slice | Extracts a portion of elements from an array starting at a specified position and returns a new array containing the extracted elements. |
| Array manipulation function | reverse | Reverses the order of elements in an array. If the array is nested, it reverses the order of elements at the top level. |
| Array manipulation function | array_map | Converts each element in an input array based on a Lambda function and returns a new array containing all the converted elements. |
| Array manipulation function | array_filter | Filters elements in an array based on the return value of a Lambda function. |
| Array manipulation function | array_sortby | Sorts an array based on a given Lambda function. |
| Array manipulation function | array_first | Returns the first element in an array that makes the return value of a given Lambda function not equal to 0. |