Skip to content

Higher-order

higher_order

filter

filter(
    col: Array[T], f: Callable[[T], Bool]
) -> Array[T]

Returns elements of array col for which f returns true.

Wrapper for pyspark.sql.functions.filter.

aggregate

aggregate(
    col: Array[T], init: I, f: Callable[[I, T], I]
) -> I

Reduces array col to a single value by applying f(accumulator, element), starting from init.

Wrapper for pyspark.sql.functions.aggregate.

transform

transform(
    col: Array[I], f: Callable[[I], O]
) -> Array[O]
transform(
    col: Array[I], f: Callable[[I, Integer], O]
) -> Array[O]
transform(
    col: Array[I],
    f: Callable[[I], O] | Callable[[I, Integer], O],
) -> Array[O]

Applies f to each element of array col and returns a new array of the results.

f takes either the element, or the element and its 0-based index (ts.Integer).

Wrapper for pyspark.sql.functions.transform.

options: show_root_heading: false