Skip to content

Executor: lower PromQL subqueries over a selector or a per-series range function (series_window with steps, window from read_window) #1318

Open

Description

@zzylol

Problem, by example

An exact PromQL subquery over a selector or over a per-series range function plans, and then fails at install. Workload: one repeating query every 60 s at phase 0, exact (max_error 0), 10 series of c sampled every 10 s, 1,000 rows held, ingesting at 100 rows/s. plan_installable on main (59365ce80):

Query (exact) Today Expected (Prometheus semantics)
max_over_time(c[10m:1m]) installable plan: the executor cannot compile the plan's query run: invalid DAG: node 2: invalid DAG: value operation has no native implementation the largest of c evaluated at the multiples of 1 minute in (T - 10m, T]
max_over_time(rate(c[1m])[10m:1m]) the same error, at node 4 the largest of rate(c[1m]) evaluated at the multiples of 1 minute in (T - 10m, T]

Concrete values, from the acceptance tests of the closed branch exec/x4-time-operators (crates/planner/tests/time_operators.rs there): a counter of job a sampled every 10 s from T - 700 s to T, growing 1 per sample, 6 per sample in (T - 300 s, T - 240 s] and 100 per sample in (T - 660 s, T - 600 s]:

Query at T Expected
max_over_time(rate(c[1m])[10m:1m]) 0.6 (the step T - 240 s)
min_over_time(rate(c[1m])[10m:1m]) 0.1
max_over_time(rate(c[1m])[10m:1m] offset 5m) 10.0 (the grid T - 840 s … T - 300 s holds T - 600 s)

And for a gauge g of job a with 100 at T - 600 s, 1 at T - 540 s, 5 at T - 300 s, 9 at T - 30 s and 50 at T + 30 s, evaluated at T + 30 s: max_over_time(g[10m:1m]) = 5, min_over_time(g[10m:1m]) = 1, count_over_time(g[10m:1m]) = 2.

Why it happens

The executor's physical_planner::bind_operation (crates/executor/src/physical_planner/mod.rs) has no arm for NonASAPOp::PromqlSubquery, so it falls to value operation has no native implementation. Operator::series_window (crates/executor/src/operators/series_window.rs) already takes steps: Option<SubquerySteps>, but no compile path builds one.

The planner no longer refuses this shape: the planner-side executor-support checks were removed, so the gap shows up at install as QueryRunNotExecutable.

Proposal

Scope and acceptance

Status and related work

Activity

  1. added
    enhancementNew feature or request
    promqlPromQL front-end lowering (L1→L2)
    windowWindow functions, frames, panes, or temporal semantics
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestnested queriespromqlPromQL front-end lowering (L1→L2)windowWindow functions, frames, panes, or temporal semantics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions