array_distinct

array_distinct(input_array: array) -> input_array

Returns a new array that contains only the distinct elements from the input array after removing duplicate elements.

The function is not guaranteed to return the elements in the array in a specific order.

The function is NULL-safe, which means that it treats NULLs as values and multiple NULLS will be de-duplicated into a single NULL.

Domain

This is a scalar function (calculates a single output value for a single input row).

Categories

Examples

Make the column 'foo' with the array [1, 2, 3, 5, null] (not necessarily in this order) after removing duplicate values.

Returns null when the input passed is null.

Make the column 'foo' with an array containing a single object {"apple":"fruit","tea":"drink"}.