v.19.17New Feature

Add Arrayfill and Arrayreversefill Functions, Which Replace Elements by Other Elements in Front/back of Them in the Array

Add arrayFill and arrayReverseFill functions, which replace elements by other elements in front/back of them in the array. #7380 (hcz)
Introduces two new functions, arrayFill and arrayReverseFill, which replace elements in an array with other elements from the front or back of the array, respectively.

Why it matters

These functions address the need to transform arrays by filling elements based on neighboring elements from either the beginning or the end, enabling more flexible array manipulation and data transformation in ClickHouse queries.

How to use it

Use arrayFill to replace elements in an array with elements from the front side of the array, and arrayReverseFill to do so from the back side. Call these functions in your SQL queries by passing the target array as an argument, for example:

SELECT arrayFill(your_array) FROM your_table;
SELECT arrayReverseFill(your_array) FROM your_table;