maxIntersections
도입 버전: v20.1.0
인터벌 그룹이 서로 겹치는 최대 횟수를 계산하는 집계 함수입니다(모든 인터벌이 최소 한 번 이상 서로 겹치는 경우).
구문
maxIntersections(start_column, end_column)인수
start_column— 각 인터벌의 시작을 나타내는 숫자 컬럼입니다.start_column이NULL이거나 0이면 해당 인터벌은 건너뜁니다.(U)Int*또는Float*end_column— 각 인터벌의 끝을 나타내는 숫자 컬럼입니다.end_column이NULL이거나 0이면 해당 인터벌은 건너뜁니다.(U)Int*또는Float*
반환 값
겹치는 인터벌의 최대 개수를 반환합니다. UInt64
예시
최대 겹침 개수 계산
CREATE TABLE my_events (
start UInt32,
end UInt32
)
ENGINE = MergeTree
ORDER BY tuple();
INSERT INTO my_events VALUES
(1, 3),
(1, 6),
(2, 5),
(3, 7);
SELECT maxIntersections(start, end) FROM my_events;┌─maxIntersections(start, end)─┐
│ 3 │
└──────────────────────────────┘