Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

maxIntersectionsPosition

maxIntersectionsPosition

Introducido en: v1.1.0

Función de agregación que calcula las posiciones en las que aparece la función maxIntersections.

Sintaxis

maxIntersectionsPosition(start_column, end_column)

Argumentos

  • start_column — Una columna numérica que representa el inicio de cada intervalo. Si start_column es NULL o 0, se omitirá el intervalo. (U)Int* o Float*
  • end_column — Una columna numérica que representa el final de cada intervalo. Si end_column es NULL o 0, se omitirá el intervalo. (U)Int* o Float*

Valor devuelto

Devuelve las posiciones iniciales del mayor número de intervalos que se intersecan. Any

Ejemplos

Encontrar la posición con el máximo número de intersecciones

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