To use array functions, you must have either the UDTTYPE or UDTMETHOD privilege on the SYSUDTLIB database. Use the following commands to grant the required permissions:
GRANT UDTMETHOD ON SYSUDTLIB TO <USER>; GRANT SELECT ON UDTInfo TO <USER>;
See the Array Functions section of Teradata Package for Python Function Reference at https://docs.teradata.com/ for detailed description and usage examples of these functions.
| Sr. No. | Function Name | Description |
|---|---|---|
| 1 | array_gt() | Checks if array elements are greater than the corresponding elements of another array or a scalar value. |
| 2 | array_ge() | Checks if array elements are greater than or equal to the corresponding elements of another array or a scalar value. |
| 3 | array_lt() | Checks if array elements are less than the corresponding elements of another array or a scalar value. |
| 4 | array_le() | Checks if array elements are less than or equal to the corresponding elements of another array or a scalar value. |
| 5 | array_eq() | Checks if array elements are equal to the corresponding elements of another array or a scalar value. |
| 6 | array_ne() | Checks if array elements are not equal to the corresponding elements of another array or a scalar value. |
| 7 | array_add() | Adds elements of one array to the corresponding elements of another array or a scalar value. |
| 8 | array_sub() | Subtracts elements of one array from the corresponding elements of another array or a scalar value. |
| 9 | array_mul() | Multiplies elements of one array with the corresponding elements of another array or a scalar value. |
| 10 | array_mod() | Computes the modulus of elements of one array with the corresponding elements of another array or a scalar value. |
| 11 | array_div() | Divides elements of one array by the corresponding elements of another array or a scalar value. |
| 12 | array_sum() | Computes the sum of all the elements in an array. |
| 13 | array_avg() | Computes the average of elements in an array. |
| 14 | array_max() | Gets the maximum value from the array. |
| 15 | array_min() | Gets the minimum value from the array. |
| 16 | array_count_distinct() | Counts the number of distinct elements in an array. |
| 17 | array_compare() | Compares the elements of the array with another array. |
| 18 | array_update() | Updates the element at a specific index or subset of elements in an array with a new value. |
| 19 | array_concat() | Concatenates two arrays into a single array. |
| 20 | array_append() | Appends an element to the end of an array. |
| 21 | array_prepend() | Prepends an element to the beginning of an array. |
| 22 | array_contains() | Checks if an array contains a specific element. |
| 23 | array_size() | Gets the size of an array. |
| 24 | array_agg() | Aggregates the rows of a column into an array. |
| 25 | total_initialized_elements() | Gets the total number of initialized elements in an array. |
| 26 | get() | Gets the element at a specific index in an array. |
| 27 | element_state() | Checks if the element at a specific index in an array is initialized or uninitialized. |
| 28 | limit() | Gets the highest possible subscript value in the array. |
| 29 | first_index() | Gets the lowest subscript value in an array. |
| 30 | last_index() | Gets the highest subscript value in an array. |
| 31 | prior() | Gets the subscript of the element prior to the element specified for the array. |
| 32 | next() | Gets the subscript of the element next to the element specified for the array. |
| 33 | extend() | Extends the space for one or more new elements in an array. |
| 34 | array_trim() | Trims elements from the end of the array. |
| 35 | array_sort() | Sorts the elements of an array in ascending or descending order. |
| 36 | array_join() | Joins the elements of an array into a single string with a specified delimiter. |
| 37 | array_overlap() | Checks if two arrays have any elements in common. |
| 38 | array_insert() | Inserts an element at a specific index in an array. |
| 39 | array_remove() | Removes all occurrences of a specified element from an array. |
| 40 | array_distinct() | Removes duplicate elements from an array. |
| 41 | array_intersect() | Returns the intersection of two arrays. |
| 42 | array_union() | Returns the union of two arrays with distinct elements. |
| 43 | array_except() | Returns the elements of the first array that are not in the second array. |
| 44 | array_compact() | Removes null elements from an array. |
| 45 | array_reverse() | Reverses the order of elements in an array. |
| 46 | array_repeat() | Creates an array by repeating a value a specified number of times. |
| 47 | array_position() | Gets the position of an element in the array. |
| 48 | slice() | Gets a subset of an array based on the specified start index and length. |
| 49 | shuffle() | Shuffles the elements of the array randomly. |