Relational Data - Aggregate Functions - Reference - Aggthrow

From FojiSoft Docs
Revision as of 18:43, 28 August 2024 by Chris.Hansen (talk | contribs) (Import ClickHouse Docs: Wed Aug 28 2024 14:43:32 GMT-0400 (Eastern Daylight Time))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)