Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

anyHeavy

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 │
└───────┘
Navigation