Skip to content

Wire the smoothed / anchored range-selector modifiers (grammar productions for existing stub tokens) #1

Description

@zzylol

Summary

smoothed / anchored range-selector modifiers parse-fail, e.g. increase(metric[1m] smoothed)invalid promql query. Both are recent Prometheus range-vector modifiers.

Current state (verified on asap @ c51beaf)

The tokens exist but are wired to nothing:

  • src/parser/token.rs: ("smoothed", T_SMOOTHED), T_SMOOTHED => "smoothed" — the lexer recognizes them.
  • src/parser/promql.y:124: %expect-unused 'SMOOTHED' 'ANCHORED' — declared as tokens no production consumes.

This is inherited verbatim from GreptimeTeam upstream main, which also stubs them with the same %expect-unused line. So this is not a mirror/rebase away — upstream has not wired them either.

Work

  • Add a grammar production consuming SMOOTHED / ANCHORED on matrix_selector (and subquery_expr), removing them from %expect-unused.
  • Add an AST field on the matrix/subquery selector to carry the modifier.
  • The lexer/token half is already done.

Corpus impact

61 rejections in the ASAPController PromQL corpus. Closest-to-done of the grammar gaps, since the token layer exists.

Constraint

All changes land on the asap branch. Do not sync or PR against GreptimeTeam upstream.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions