v.22.1Improvement

Short Circuit Evaluation Support for throwIf Function

Short circuit evaluation: support for function throwIf. Closes #32969. #32973 (Maksim Kita).
Introduces support for the throwIf function with short-circuit evaluation in ClickHouse.

Why it matters

The throwIf function allows users to raise exceptions conditionally during query execution. This feature improves query control flow by enabling error throwing only when specific conditions are met, preventing unnecessary evaluations and enhancing debugging and validation within queries.

How to use it

Use the throwIf function within SQL queries to conditionally raise exceptions based on expressions. For example:

SELECT throwIf(column = 0, 'Division by zero error')
FROM table

The function evaluates the condition and throws an error if the condition is true, stopping further execution.