fc.arr.*.
Basic Operations
size
Returns the number of elements in an array column.Column or column name containing arrays whose length to compute.
A Column expression representing the array length. Returns None for None arrays.
Example
contains
Checks if array column contains a specific value.Column or column name containing the arrays to check.
Value to search for in the arrays. Can be a literal value or a Column expression.
A boolean Column expression (True if value is found, False otherwise).
Example
element_at
Returns the element at the given index in an array using 1-based indexing.Column or column name containing arrays.
Index of the element (1-based). Positive indices count from the start (1 = first element), negative indices count from the end (-1 = last element).
A Column containing the element at the specified index.
Example
Transformations
distinct
Removes duplicate values from an array column.Column or column name containing arrays.
A new column that is an array of unique values from the input column.
Example
sort
Sorts the array in ascending order.Column or column name containing arrays of comparable types (numeric, string, date, boolean).
A Column with sorted arrays in ascending order. Null values are placed at the end.
Example
reverse
Reverses the elements of an array.Column or column name containing arrays.
A Column with reversed arrays.
Example
compact
Removes null values from an array.Column or column name containing arrays.
A Column with arrays having null values removed.
Example
slice
Extracts a subarray from an array using 1-based indexing.Column or column name containing arrays.
Starting position (1-based index). Positive indices count from the start, negative indices count from the end.
Number of elements to extract. Must be positive.
A Column with subarrays extracted.
Example
Set Operations
union
Returns the union of two arrays without duplicates.First array column or column name.
Second array column or column name.
A Column containing the distinct union of both arrays.
Example
intersect
Returns the intersection of two arrays.First array column or column name.
Second array column or column name.
A Column containing distinct elements present in both arrays.
Example
except_
Returns elements in the first array but not in the second.First array column or column name.
Second array column or column name.
A Column containing distinct elements in col1 but not in col2.
Example
overlap
Checks if two arrays have at least one common element.First array column or column name.
Second array column or column name.
A boolean Column (True if arrays have common elements, False otherwise).
Example
Aggregation
max
Returns the maximum value in an array.Column or column name containing arrays of comparable types (numeric, string, date, boolean).
A Column containing the maximum value from each array. Returns null if the array is null or empty.
Example
min
Returns the minimum value in an array.Column or column name containing arrays of comparable types.
A Column containing the minimum value from each array. Returns null if the array is null or empty.
Example
Utility
remove
Removes all occurrences of an element from an array.Column or column name containing arrays.
Element to remove from the arrays. Can be a literal value or a Column expression.
A Column with arrays having all occurrences of the element removed.
Example
repeat
Creates an array containing the element repeated count times.Column, column name, or literal value to repeat.
Number of times to repeat the element. Can be an integer literal or a Column expression.
A Column containing an array with the element repeated count times.
