> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 線形補間によりヒストグラムの分位点を計算します。

# quantilePrometheusHistogram

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

導入バージョン: v25.10.0

各ヒストグラムバケットの累積値と上限境界を考慮し、線形補間を用いてヒストグラムの[分位点](https://en.wikipedia.org/wiki/Quantile)を計算します。

補間値を取得するには、渡されたすべての値を1つの配列にまとめ、その後、対応するバケットの上限境界値でソートします。
続いて、分位点の位置が見つかったバケットの下限と上限を使って線形補間を行い、クラシックヒストグラムに対する PromQL の [histogram\_quantile()](https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile) 関数と同様に分位点補間を実行します。

**関連項目**

* [median](/ja/reference/functions/aggregate-functions/median)
* [quantiles](/ja/reference/functions/aggregate-functions/quantiles)

**構文**

```sql theme={null}
quantilePrometheusHistogram(level)(bucket_upper_bound, cumulative_bucket_value)
```

**パラメータ**

* `level` — 任意。分位点 のレベルです。`0` 以上 `1` 以下の定数浮動小数点数です。`level` には `[0.01, 0.99]` の範囲の値を使用することを推奨します。デフォルト値: `0.5`。`level=0.5` の場合、この関数は [中央値](https://en.wikipedia.org/wiki/Median) を計算します。[`Float64`](/ja/reference/data-types/float)

**引数**

* `bucket_upper_bound` — ヒストグラムバケットの上限値です。最も大きいバケットの上限は `+Inf` である必要があります。[`Float64`](/ja/reference/data-types/float)
* `cumulative_bucket_value` — ヒストグラムバケットの累積値です。値は、バケットの上限が増加するにつれて単調増加である必要があります。[`(U)Int*`](/ja/reference/data-types/int-uint) または [`Float64`](/ja/reference/data-types/float)

**戻り値**

指定したレベルの 分位点 を返します。[`Float64`](/ja/reference/data-types/float)

**例**

**使用例**

```sql title=Query theme={null}
SELECT quantilePrometheusHistogram(bucket_upper_bound, cumulative_bucket_value)
FROM VALUES('bucket_upper_bound Float64, cumulative_bucket_value UInt64', (0, 6), (0.5, 11), (1, 14), (inf, 19));
```

```response title=Response theme={null}
┌─quantilePrometheusHistogram(bucket_upper_bound, cumulative_bucket_value)─┐
│                                                                     0.35 │
└──────────────────────────────────────────────────────────────────────────┘
```

**関連項目**

* [median](/ja/reference/functions/aggregate-functions/median)
* [quantiles](/ja/reference/functions/aggregate-functions/quantiles)
