v.25.11New Feature
Support arrayRemove to remove all elements equal
Support forarrayRemoveto remove all elements equal toelemfrom the arrayarr. Which is only needed for compatibility with Postgres, as ClickHouse already has a way more powerful,arrayFilterfunction. Resolves #52099. #89585 (tiwarysaurav).
Why it matters
This feature provides compatibility with Postgres by introducing thearrayRemove function, allowing users to remove all occurrences of a specified element from an array easily. Although ClickHouse already offers the more flexible arrayFilter function, arrayRemove simplifies scenarios where only removal of equal elements is needed.How to use it
Use thearrayRemove(arr, elem) function where arr is the array and elem is the element to be removed from the array. It returns a new array excluding all elements equal to elem.Example:
SELECT arrayRemove([1, 2, 3, 2], 2);
-- Result: [1, 3]