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

> heavy hitters アルゴリズムを使用して、高頻度で出現する値を選択します。 各クエリ実行スレッドで過半数を占める値がある場合、その値を返します。 通常、結果は非決定論的です。

# anyHeavy

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

導入バージョン: v1.1.0

[heavy hitters](https://doi.org/10.1145/762471.762473) アルゴリズムを使用して、頻出する値を選択します。
クエリの各実行スレッドで出現回数が半数を超える値がある場合、その値が返されます。
通常、結果は非決定論的です。

**構文**

```sql theme={null}
anyHeavy(column)
```

**引数**

* `column` — カラム名。 [`String`](/ja/reference/data-types/string)

**戻り値**

頻出する値を返します。結果は非決定論的です。 [`Any`](/ja/reference/data-types/index)

**例**

**使用例**

```sql title=Query theme={null}
CREATE TABLE ontime (AirlineID UInt32) ENGINE = Memory;

-- Three quarters of the flights belong to one airline, so it occurs in more than half of the
-- rows seen by every thread and the result is the same on every run.
INSERT INTO ontime SELECT if(number % 4 = 0, 19393, 19690) FROM numbers(1000);

SELECT anyHeavy(AirlineID) AS res
FROM ontime;
```

```response title=Response theme={null}
┌───res─┐
│ 19690 │
└───────┘
```
