ClickHouse/docs/en/sql-reference/aggregate-functions/reference/anyheavy.md

31 lines
707 B
Markdown
Raw Normal View History

---
2022-03-30 04:06:21 +00:00
sidebar_position: 103
---
# anyHeavy {#anyheavyx}
Selects a frequently occurring value using the [heavy hitters](http://www.cs.umd.edu/~samir/498/karp.pdf) algorithm. If there is a value that occurs more than in half the cases in each of the querys execution threads, this value is returned. Normally, the result is nondeterministic.
``` sql
anyHeavy(column)
```
**Arguments**
- `column` The column name.
**Example**
2022-04-02 23:38:54 +00:00
Take the [OnTime](../../../example-datasets/ontime.md) data set and select any frequently occurring value in the `AirlineID` column.
``` sql
SELECT anyHeavy(AirlineID) AS res
FROM ontime
```
``` text
┌───res─┐
│ 19690 │
└───────┘
```