ClickHouse/docs/en/sql-reference/aggregate-functions/reference/aggthrow.md
2024-07-05 21:50:56 +02:00

837 B

slug sidebar_position
/en/sql-reference/aggregate-functions/reference/aggthrow 101

aggThrow

This function can be used for the purpose of testing exception safety. It will throw an exception on creation with the specified probability.

Syntax

aggThrow(throw_prob)

Arguments

  • throw_prob — Probability to throw on creation. Float64.

Returned value

  • An exception: Code: 503. DB::Exception: Aggregate function aggThrow has thrown exception successfully.

Example

Query:

SELECT number % 2 AS even, aggThrow(number) FROM numbers(10) GROUP BY even;

Result:

Received exception:
Code: 503. DB::Exception: Aggregate function aggThrow has thrown exception successfully: While executing AggregatingTransform. (AGGREGATE_FUNCTION_THROW)