v.21.7Improvement

Add support for if function with Decimal and Int types

Add support for function if with Decimal and Int types on its branches. This closes #20549. This closes #10142. #25283 (alexey-milovidov).
Added support for the if function to handle Decimal and Int types on its branches.

Why it matters

This feature resolves issues where the if function could not process expressions with differing Decimal and Int types in its branches, enhancing type compatibility and function flexibility for users.

How to use it

Users can now use the if function with branches returning Decimal or Int types transparently without additional type casting. Example usage:

SELECT if(condition, decimal_value, int_value) FROM table