> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> 使用确定性采样，一次性计算数值数据序列在不同级别上的多个近似分位数。

# quantilesDeterministic

<div id="quantilesDeterministic">
  ## quantilesDeterministic
</div>

引入版本：v1.1.0

使用确定性水塘抽样，同时计算数值数据序列在不同级别上的多个近似[分位数](https://en.wikipedia.org/wiki/Quantile)。

此函数等同于 [`quantileDeterministic`](/docs/zh/reference/functions/aggregate-functions/quantileDeterministic)，但它支持在一次遍历中计算多个分位级别，因此比逐个调用各个分位函数更高效。

**语法**

```sql theme={null}
quantilesDeterministic(level1, level2, ...)(expr, determinator)
```

**参数**

* `level` — 分位数的级别。一个或多个介于 0 到 1 之间的常量浮点数。建议将 `level` 值设在 `[0.01, 0.99]` 范围内。[`Float*`](/docs/zh/reference/data-types/float)

**Arguments**

* `expr` — 基于列值计算的表达式，其结果为数值数据类型、`Date` 或 `DateTime`。[`(U)Int*`](/docs/zh/reference/data-types/int-uint) 或 [`Int128`](/docs/zh/reference/data-types/int-uint) 或 [`UInt128`](/docs/zh/reference/data-types/int-uint) 或 [`Int256`](/docs/zh/reference/data-types/int-uint) 或 [`UInt256`](/docs/zh/reference/data-types/int-uint) 或 [`Float*`](/docs/zh/reference/data-types/float) 或 [`Date`](/docs/zh/reference/data-types/date) 或 [`DateTime`](/docs/zh/reference/data-types/datetime)
* `determinator` — 在蓄水池采样算法中，其哈希值会替代随机数生成器使用的随机数，从而使采样结果具有确定性。[`UInt*`](/docs/zh/reference/data-types/int-uint)

**返回值**

按指定级别返回的近似分位数组，顺序与级别的指定顺序一致。[`Array(Float64)`](/docs/zh/reference/data-types/array) 或 [`Array(Date)`](/docs/zh/reference/data-types/array) 或 [`Array(DateTime)`](/docs/zh/reference/data-types/array)

**示例**

**计算多个确定性分位数**

```sql title=Query theme={null}
SELECT quantilesDeterministic(0.25, 0.5, 0.75)(number, number) FROM numbers(10)
```

```response title=Response theme={null}
┌─quantilesDeterministic(0.25, 0.5, 0.75)(number, number)─┐
│ [2.25,4.5,6.75]                                         │
└─────────────────────────────────────────────────────────┘
```
