v.23.8New Feature

Added Support for Array Addition and Subtraction in ClickHouse

Added support for adding and subtracting arrays: [5,2] + [1,7]. Division and multiplication were not implemented due to confusion between pointwise multiplication and the scalar product of arguments. Closes #49939. #52625 (Yarik Briukhovetskyi).
Added support for element-wise addition and subtraction of arrays in ClickHouse, enabling expressions like [5,2] + [1,7].

Why it matters

This feature allows users to perform arithmetic operations on arrays directly, simplifying queries that involve array data by supporting intuitive element-wise addition and subtraction. It addresses the need for straightforward array manipulation without requiring manual element iteration or complex functions.

How to use it

Use the standard arithmetic operators + and - between arrays to perform element-wise addition or subtraction. For example, [5,2] + [1,7] returns [6,9]. Multiplication and division for arrays are currently not supported due to ambiguity in operation semantics.