You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enhance Collection Functions of Array() function as below:
CARDINALITY(array)--Returns the number of elements in array.
ELEMENT(array)--Returns the sole element of array (whose cardinality should be one); returns NULL if array is empty. Throws an exception if array has more than one element.
ARRAY_APPEND(array, element)--Appends an element to the end of the array and returns the result. If the array itself is null, the function will return null. If an element to add is null, the null element will be added to the end of the array.
ARRAY_CONTAINS(haystack, needle)--Returns whether the given element exists in an array. Checking for null elements in the array is supported. If the array itself is null, the function will return null.
ARRAY_DISTINCT(haystack)--Returns an array with unique elements. If the array itself is null, the function will return null. Keeps ordering of elements.
ARRAY_POSITION(haystack, needle)--Returns the position of the first occurrence of element in the given array as int. Returns 0 if the given value could not be found in the array. Returns null if either of the arguments are null. And this is not zero based, but 1-based index. The first element in the array has index 1.
ARRAY_PREPEND(array, element)--Appends an element to the beginning of the array and returns the result. If the array itself is null, the function will return null. If an element to add is null, the null element will be added to the beginning of the array.
ARRAY_REMOVE(haystack, needle)--Removes all elements that equal to element from array. If the array itself is null, the function will return null. Keeps ordering of elements.
ARRAY_REVERSE(haystack)--Returns an array in reverse order. If the array itself is null, the function will return null.
ARRAY_SLICE(array, start_offset[, end_offset])--Returns a subarray of the input array between ‘start_offset’ and ’end_offset’ inclusive. The offsets are 1-based however 0 is also treated as the beginning of the array. Positive values are counted from the beginning of the array while negative from the end. If ’end_offset’ is omitted then this offset is treated as the length of the array. If ‘start_offset’ is after ’end_offset’ or both are out of array bounds an empty array will be returned. Returns null if any input is null.
ARRAY_SORT(array[, ascending_order[, null_first]])--Returns the array in sorted order.The function sorts an array, defaulting to ascending order with NULLs at the start when only the array is input. Specifying ascending_order as true orders the array in ascending with NULLs first, and setting it to false orders it in descending with NULLs last. Independently, null_first as true moves NULLs to the beginning, and as false to the end, irrespective of the sorting order. The function returns null if any input is null.
ARRAY_UNION(array1, array2)--Returns an array of the elements in the union of array1 and array2, without duplicates. If any of the array is null, the function will return null.
ARRAY_CONCAT(array1, …)--Returns an array that is the result of concatenating at least one array. This array contains all the elements in the first array, followed by all the elements in the second array, and so forth, up to the Nth array. If any input array is NULL, the function returns NULL.
ARRAY_EXCEPT(array1, array2)--Returns an ARRAY that contains the elements from array1 that are not in array2, without duplicates. If no elements remain after excluding the elements in array2 from array1, the function returns an empty ARRAY. If one or both arguments are NULL, the function returns NULL. The order of the elements from array1 is kept.
ARRAY_INTERSECT(array1, array2)--Returns an ARRAY that contains the elements from array1 that are also in array2, without duplicates. If no elements that are both in array1 and array2, the function returns an empty ARRAY. If any of the array is null, the function will return null. The order of the elements from array1 is kept.
ARRAY_MAX(array)--Returns the maximum value from the array, if array itself is null, the function returns null.
ARRAY_JOIN(array, delimiter[, nullReplacement])--Returns a string that represents the concatenation of the elements in the given array and the elements’ data type in the given array is string. The delimiter is a string that separates each pair of consecutive elements of the array. The optional nullReplacement is a string that replaces null elements in the array. If nullReplacement is not specified, null elements in the array will be omitted from the resulting string. Returns null if input array or delimiter or nullReplacement are null.
ARRAY_MIN(array)--Returns the minimum value from the array, if array itself is null, the function returns null.
Description
CARDINALITY(array)
--Returns the number of elements in array.ELEMENT(array)
--Returns the sole element of array (whose cardinality should be one); returns NULL if array is empty. Throws an exception if array has more than one element.ARRAY_APPEND(array, element)
--Appends an element to the end of the array and returns the result. If the array itself is null, the function will return null. If an element to add is null, the null element will be added to the end of the array.ARRAY_CONTAINS(haystack, needle)
--Returns whether the given element exists in an array. Checking for null elements in the array is supported. If the array itself is null, the function will return null.ARRAY_DISTINCT(haystack)
--Returns an array with unique elements. If the array itself is null, the function will return null. Keeps ordering of elements.ARRAY_POSITION(haystack, needle)
--Returns the position of the first occurrence of element in the given array as int. Returns 0 if the given value could not be found in the array. Returns null if either of the arguments are null. And this is not zero based, but 1-based index. The first element in the array has index 1.ARRAY_PREPEND(array, element)
--Appends an element to the beginning of the array and returns the result. If the array itself is null, the function will return null. If an element to add is null, the null element will be added to the beginning of the array.ARRAY_REMOVE(haystack, needle)
--Removes all elements that equal to element from array. If the array itself is null, the function will return null. Keeps ordering of elements.ARRAY_REVERSE(haystack)
--Returns an array in reverse order. If the array itself is null, the function will return null.ARRAY_SLICE(array, start_offset[, end_offset])
--Returns a subarray of the input array between ‘start_offset’ and ’end_offset’ inclusive. The offsets are 1-based however 0 is also treated as the beginning of the array. Positive values are counted from the beginning of the array while negative from the end. If ’end_offset’ is omitted then this offset is treated as the length of the array. If ‘start_offset’ is after ’end_offset’ or both are out of array bounds an empty array will be returned. Returns null if any input is null.ARRAY_SORT(array[, ascending_order[, null_first]])
--Returns the array in sorted order.The function sorts an array, defaulting to ascending order with NULLs at the start when only the array is input. Specifying ascending_order as true orders the array in ascending with NULLs first, and setting it to false orders it in descending with NULLs last. Independently, null_first as true moves NULLs to the beginning, and as false to the end, irrespective of the sorting order. The function returns null if any input is null.ARRAY_UNION(array1, array2)
--Returns an array of the elements in the union of array1 and array2, without duplicates. If any of the array is null, the function will return null.ARRAY_CONCAT(array1, …)
--Returns an array that is the result of concatenating at least one array. This array contains all the elements in the first array, followed by all the elements in the second array, and so forth, up to the Nth array. If any input array is NULL, the function returns NULL.ARRAY_EXCEPT(array1, array2)
--Returns an ARRAY that contains the elements from array1 that are not in array2, without duplicates. If no elements remain after excluding the elements in array2 from array1, the function returns an empty ARRAY. If one or both arguments are NULL, the function returns NULL. The order of the elements from array1 is kept.ARRAY_INTERSECT(array1, array2)
--Returns an ARRAY that contains the elements from array1 that are also in array2, without duplicates. If no elements that are both in array1 and array2, the function returns an empty ARRAY. If any of the array is null, the function will return null. The order of the elements from array1 is kept.ARRAY_MAX(array)
--Returns the maximum value from the array, if array itself is null, the function returns null.ARRAY_JOIN(array, delimiter[, nullReplacement])
--Returns a string that represents the concatenation of the elements in the given array and the elements’ data type in the given array is string. The delimiter is a string that separates each pair of consecutive elements of the array. The optional nullReplacement is a string that replaces null elements in the array. If nullReplacement is not specified, null elements in the array will be omitted from the resulting string. Returns null if input array or delimiter or nullReplacement are null.ARRAY_MIN(array)
--Returns the minimum value from the array, if array itself is null, the function returns null.Use case
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: