Files
greptimedb/src/query
discord9 fa7056eae7 feat(promql): match an empty on() and grouped cardinalities natively (#10223)
The compiler already carries an empty `on()` and both grouped cardinalities,
and the matcher kernel implements them; only the planner's narrow region-local
allowlist refused them, so those queries fell back. Admit them: the pair is
planned as one native binary over the two operands, matching above their
sources.

Admitting them exposed an output-schema bug the allowlist was hiding: both tag
walks treated an empty `on()` as "keep every tag", so the output carried
labels the kernel had dropped. They now keep only the specified labels, and a
grouped match keeps the many side's labels and copies the included ones from
the one side.

Tests: the empty-`on()` subtraction and the `group_left()` form assert native
execution with their original rows and labels, and four cases assert the
kernel's cardinality errors - duplicate right under `on()` and `group_left()`,
an implicit many-to-one under `on()`, and duplicate left under `group_right()`.
The subquery case in the same loop keeps its fallback.

Signed-off-by: discord9 <discord9@163.com>
2026-11-06 18:10:58 +08:00
..