> ## 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.

> 与 quantilesBFloat16 类似，但会将每个值的权重考虑在内。

# quantilesBFloat16Weighted

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

引入版本：v21.10.0

与 [`quantilesBFloat16`](/docs/zh/reference/functions/aggregate-functions/quantilesBFloat16) 类似，但会将每个值的权重纳入计算。

在一次遍历中，同时计算由 [bfloat16](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) 数值组成的样本在不同级别上的多个近似[分位数](https://en.wikipedia.org/wiki/Quantile)。

**语法**

```sql theme={null}
quantilesBFloat16Weighted(level1, level2, ...)(expr, weight)
```

**参数**

* `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) 或 [`Float*`](/docs/zh/reference/data-types/float) 或 [`Date`](/docs/zh/reference/data-types/date) 或 [`DateTime`](/docs/zh/reference/data-types/datetime)
* `weight` — 包含序列成员权重的列。权重表示某个值出现的次数。[`UInt*`](/docs/zh/reference/data-types/int-uint)

**返回值**

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

**示例**

**计算多个加权 bfloat16 分位数**

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

```response title=Response theme={null}
┌─quantilesBFloat16Weighted(0.25, 0.5, 0.75)(number, 1)─┐
│ [2,4,7]                                               │
└───────────────────────────────────────────────────────┘
```
