Array Functions

Array

Returns an array with the given elements.

Input Parameters:

arg0: The given columns to create array column.

Configuration ParametersNo
ReturnsReturns an array with the given elements.
ThrowsApplication Exception

Example:

array(1, 2, 3) will return [1,2,3]


Array_union

Returns an array of the elements in the union of array1 and array2, without duplicates.

Input Parameters:

arg0: The first array column.

arg1: The second array column.

Configuration ParametersNo
ReturnsReturns an array of the elements in the union of array1 and array2, without duplicates.
ThrowsApplication Exception

Example:

array_union(array(1, 2, 3), array(1, 3, 5)) will return [1,2,3,5]


array_distinct

Removes duplicate values from the array.

Input Parameters:

arg0: The given array column.

Configuration ParametersNo
ReturnsReturns the array with duplicate values removed.
ThrowsApplication Exception

Example:

array_distinct(array(1, 2, 3, null, 3)) will return [1,2,3,null]


array_except

Returns an array of the elements in array1 but not in array2, without duplicates.

Input Parameters:

arg0: First array column.

arg1: Second array column.

Configuration ParametersNo
ReturnsReturns an array of the elements in array1 but not in array2, without duplicates.
ThrowsApplication Exception

Example:

array_except(array(1, 2, 3), array(1, 3, 5)) will return [2]


array_intersect

Performs intersection of array1 and array2, without duplicates.

Input Parameters:

arg0: First array column.

arg1: Second array column.

Configuration ParametersNo
ReturnsReturns an array of the elements in the intersection of array1 and array2, without duplicates.
ThrowsApplication Exception

Example:

array_intersect(array(1, 2, 3), array(1, 3, 5)) will return [1,3]


array_join

Concatenates the elements of the given array using the delimiter and an optional string to replace nulls. If no value is set for nullReplacement, any null value is filtered.

Input Parameters:

arg0: array column.

arg1: delimiter.

arg2: nullReplacement.

Configuration ParametersNo
ReturnsReturns the concatenated array.
ThrowsApplication Exception

Example:

array_join(array('hello', null ,'world'), ' ', ',') will return hello, world


array_max

Returns the maximum value in the array. NULL elements are skipped.

Input Parameters:

arg0: The array column.

Configuration ParametersNo
ReturnsReturns the maximum value in the array. NULL elements are skipped.
ThrowsApplication Exception

Example:

array_max(array(1, 20, null, 3)) will return 20


array_min

Returns the minimum value in the array. NULL elements are skipped.

Input Parameters:

arg0: The array column.

Configuration ParametersNo
ReturnsReturns the minimum value in the array. NULL elements are skipped.
ThrowsApplication Exception

Example:

array_min(array(1, 20, null, 3)) will return 1


array_position

Returns the (1-based) index of the first element of the array as long.

Input Parameters:

arg0: The array column.

arg1: The position.

Configuration ParametersNo
ReturnsReturns the (1-based) index of the first element of the array as long.
ThrowsApplication Exception

Example:

array_position(array(3, 2, 1), 1) will return 3


array_remove

Remove all elements that equal to element from array.

Input Parameters:

arg0: The array column.

arg1: The position.

Configuration ParametersNo
ReturnsReturns the array with elements removed.
ThrowsApplication Exception

Example:

array_remove(array(1, 2, 3, null, 3), 3) will return [1,2,null]


array_repeat

Returns the array containing element count times.

Input Parameters:

arg0: The array column.

arg1: The count

Configuration ParametersNo
ReturnsReturns the array containing element count times.
ThrowsApplication Exception

Example:

array_repeat('123', 2) will return [“123”,“123”]


array_sort

Sorts the input array in ascending order. The elements of the input array must be order-able. Null elements will be placed at the end of the returned array.

Input Parameters:

arg0: The array column.

Configuration ParametersNo
ReturnsReturns the sorted array.
ThrowsApplication Exception

Example:

array_sort(array('b', 'd', null, 'c', 'a')) will return [“a”,“b”,“c”,“d”,null]


array_union

Returns an array of the elements in the union of array1 and array2, without duplicates.

Input Parameters:

arg0: The first array column.

arg1: The second array column.

Configuration ParametersNo
ReturnsReturns an array of the elements in the union of array1 and array2, without duplicates.
ThrowsApplication Exception

Example:

array_union(array(1, 2, 3), array(1, 3, 5)) will return [1,2,3,5]


array_overlap

Returns true if a1 contains at least a non-null element present also in a2. If the arrays have no common element and they are both non-empty and either of them contains a null element null is returned, false otherwise.

Input Parameters:

arg0: The first array column.

arg1: The second array column.

Configuration ParametersNo
ReturnsReturns true or false.
ThrowsApplication Exception

Example:

arrays_overlap(array(1, 2, 3), array(3, 4, 5)) will return true.


array_zip

Returns a merged array of structs in which the N-th struct contains all N-th values of input arrays.

Input Parameters:

arg0: The Columns to be zipped.

Configuration ParametersNo
ReturnsReturns a merged array of structs in which the N-th struct contains all N-th values of input arrays.
ThrowsApplication Exception

Example:

arrays_zip(array(1, 2, 3), array(2, 3, 4)) Will return [{“0”:1,“1”:2},{“0”:2,“1”:3},{“0”:3,“1”:4}]


Array_contains

Returns TRUE if the array contains value.

Input Parameters: Column arg0, Object arg1

• arg0 (required) - An array column.

• arg1 (required) - A value to be checked.

Output TypeBoolean Column
Configuration ParametersNo
ReturnsA boolean true/false
ThrowsApplication Exception

Use Case:

array_contains

Example:

array_contains(["black","red"] ,"red") will return true


explode

Separates the elements of array expr into multiple rows, or the elements of map expr into multiple rows and columns.

Input Parameters:

arg0: The expr column.

Configuration ParametersNo
ReturnsReturns the exploded column.
ThrowsApplication Exception

Example:

explode(array(10, 20)) will return 10, 20 in a new column.


explode_outer

Separates the elements of array expr into multiple rows, or the elements of map expr into multiple rows and columns.

Input Parameters:

arg0: The expr column.

Configuration ParametersNo
ReturnsReturns the exploded column.
ThrowsApplication Exception

Example:

explode_outer(array(10, 20)) will return 10, 20.

Top