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

31 lines
710 B
Markdown
Raw Normal View History

---
sidebar_position: 103
---
2022-06-02 10:55:18 +00:00
# anyHeavy
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-11 05:01:34 +00:00
Take the [OnTime](../../../getting-started/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 │
└───────┘
```