メインコンテンツへスキップ

maxIntersectionsPosition

導入バージョン: v1.1.0 maxIntersections 関数の出現位置を算出する集約関数です。 構文
maxIntersectionsPosition(start_column, end_column)
引数
  • start_column — 各インターバルの開始を表す数値カラムです。start_columnNULL または 0 の場合、そのインターバルはスキップされます。(U)Int* または Float*
  • end_column — 各インターバルの終了を表す数値カラムです。end_columnNULL または 0 の場合、そのインターバルはスキップされます。(U)Int* または Float*
戻り値 最も多くのインターバルが重なっている開始位置を返します。Any 重なりが最大となる位置の検索
Query
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;
Response
┌─maxIntersectionsPosition(start, end)─┐
│                                    2 │
└──────────────────────────────────────┘
最終更新日 2026年6月10日