anyHeavy
導入バージョン: v1.1.0
heavy hitters アルゴリズムを使用して、頻出する値を選択します。 クエリの各実行スレッドで出現回数が半数を超える値がある場合、その値が返されます。 通常、結果は非決定論的です。
構文
anyHeavy(column)引数
column— カラム名。String
戻り値
頻出する値を返します。結果は非決定論的です。 Any
例
使用例
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;┌───res─┐
│ 19690 │
└───────┘