ClickHouse/docs/zh/sql-reference/aggregate-functions/reference/anyheavy.md
2022-04-10 17:08:18 -06:00

35 lines
689 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebar_position: 103
---
# anyHeavy {#anyheavyx}
选择一个频繁出现的值,使用[heavy hitters](http://www.cs.umd.edu/~samir/498/karp.pdf) 算法。 如果某个值在查询的每个执行线程中出现的情况超过一半,则返回此值。 通常情况下,结果是不确定的。
``` sql
anyHeavy(column)
```
**参数**
- `column` The column name。
**示例**
使用 [OnTime](../../../getting-started/example-datasets/ontime.md) 数据集,并选择在 `AirlineID` 列任何频繁出现的值。
查询:
``` sql
SELECT anyHeavy(AirlineID) AS res
FROM ontime;
```
结果:
``` text
┌───res─┐
│ 19690 │
└───────┘
```