Skip to content

PromQL offset / @ time-shift modifiers have no IR representation #40

Description

@milindsrivastava1997

Problem

PromQL's offset modifier (metric offset 1h) and @ modifier (metric @ 1609746000) shift the evaluation/lookback time of a vector selector. Unlike without(...) (#39), which is blocked on missing catalog metadata, this is blocked on a missing IR node: there is no time-shift concept anywhere in relational::QueryExpr or canonical QueryExpr to carry the shift amount, so both modifiers are rejected unconditionally rather than partially/incorrectly lowered.

These are common in real dashboards and alerts (week-over-week comparisons, anomaly detection baselines), so this is a meaningful coverage gap distinct from the scalar-operand and without gaps.

Reproduction

crates/lower/src/promql.rs, vs_parts:

fn vs_parts(vs: &VectorSelector) -> Result<(String, Vec<L2Expr>)> {
    // `offset` / `@` shift the evaluation/lookback time. The intent algebra has
    // no representation for either, so silently lowering them (as if absent)
    // would change the query's meaning. Reject rather than mislower.
    if vs.offset.is_some() || vs.at.is_some() {
        return Err(LoweringError::UnsupportedFeature(
            "`offset` / `@` time-shift modifiers have no intent-algebra representation".into(),
        ));
    }
    ...

Any query with offset or @ on a vector/matrix selector — e.g. rate(http_requests_total[5m] offset 1h) or http_requests_total @ 1609746000 — fails to lower with LoweringError::UnsupportedFeature. No test exercises a successful lowering of either modifier.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions