v.25.9New Feature

Add function arrayExcept that subtracts one array

Added function arrayExcept that subtracts one array as a set from another. #82368 (Joanna Hulboj).
Added the arrayExcept function that returns an array representing the set difference of two arrays, effectively subtracting all elements of the second array from the first.

Why it matters

The arrayExcept function addresses the need to perform set subtraction operations directly on arrays within ClickHouse queries, enabling users to easily remove specified elements from an array. This simplifies queries involving array manipulation and enhances data processing capabilities.

How to use it

Use the arrayExcept(array1, array2) function in your SQL queries to obtain an array containing the elements of array1 that do not exist in array2. For example:

SELECT arrayExcept([1, 2, 3, 4], [2, 4])

will return [1, 3].