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