maxIntersectionsPosition

maxIntersectionsPosition

maxIntersections 함수가 발생하는 위치를 계산하는 집계 함수예요. v1.1.0부터 도입되었어요.

출처: 문서

본문

maxIntersections 함수의 발생 위치를 계산하는 집계 함수예요.

구문 (Syntax)

maxIntersectionsPosition(start_column, end_column)

인자 (Arguments)

  • start_column — 각 구간의 시작을 나타내는 숫자 컬럼이에요. start_columnNULL 또는 0이면 그 구간은 건너뛰어져요. (U)Int* 또는 Float*
  • end_column — 각 구간의 끝을 나타내는 숫자 컬럼이에요. end_columnNULL 또는 0이면 그 구간은 건너뛰어져요. (U)Int* 또는 Float*

반환 값 (Returned value)

최대로 교차하는 구간의 시작 위치를 반환해요. Any

예시 (Examples)

최대 교차 위치 찾기:

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 maxIntersectionsPosition(start, end) FROM my_events;

결과:

┌─maxIntersectionsPosition(start, end)─┐
│                                    2 │
└──────────────────────────────────────┘

더 알아보기 (Learn more)