v.22.2Improvement

Enable Binary Arithmetic Between Decimal and Float

Enable binary arithmetic (plus, minus, multiply, division, least, greatest) between Decimal and Float. #33355 (flynn).
Enable binary arithmetic operations between Decimal and Float types. This feature allows using operators such as plus, minus, multiply, division, least, and greatest directly between Decimal and Float values in ClickHouse.

Why it matters

Motivation: Prior to this update, arithmetic operations between Decimal and Float types were restricted or required manual casting, making queries less flexible and more complex. Enabling these operations improves usability by allowing seamless calculations and comparisons between these numeric types without explicit conversion.

How to use it

Usage: Users can now perform binary arithmetic operations like addition, subtraction, multiplication, division, and use the least and greatest functions directly between Decimal and Float columns or values in their SQL queries without needing extra casts. For example:

SELECT <code>plus</code>(decimal_column, float_column),
<code>least</code>(decimal_column, float_column)
FROM table


No special configuration is needed as this behavior is enabled by default after upgrading to the version including this feature.