> ## 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`](/zh/reference/data-types/string)

**返回值**

返回一个高频值。该结果是非确定性的。[`Any`](/zh/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 │
└───────┘
```
