跳至主要内容

aggThrow

此函数可用于测试异常安全性。它将在创建时以指定的概率抛出异常。

语法

aggThrow(throw_prob)

参数

  • throw_prob — 创建时抛出的概率。 Float64

返回值

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

示例

查询

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

结果

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