v.20.3New Feature

Add moduloOrZero function

Add function moduloOrZero #9358 (hcz)
Added the function moduloOrZero to ClickHouse.

Why it matters

The moduloOrZero function provides a safer modulo operation that returns zero instead of error or undefined results when the divisor is zero. This prevents query failures and improves robustness when performing modulo calculations that might include zero divisors.

How to use it

Use the function in your SQL queries as moduloOrZero(dividend, divisor). It will return the modulo result when the divisor is non-zero and zero when the divisor is zero.