Aggregate Functions
Test error handling
Simulate errors and exceptions in aggregations.
ClickHouse function reference
aggThrow
Throws an exception with a specified probability. This function is primarily used for testing exception handling and safety in ClickHouse.
Syntax:
Arguments:
throw_prob
(Float64
): The probability of throwing an exception. Value should be between 0 and 1.
Returns:
This function doesn’t return a value. Instead, it throws an exception with the following message:
Example:
This query attempts to count tacos by type, but has a 50% chance of throwing an exception for each group. If an exception is thrown, you might see:
This function is not intended for use in production environments. It’s designed for testing how your system handles exceptions in aggregate functions.
Was this page helpful?