Skip to content

Port native-histogram trim operators </ (TRIM_UPPER) and >/ (TRIM_LOWER) #2

Description

@zzylol

Summary

The native-histogram trim operators parse-fail: h_test </ +Inf, h_test >/ 1.41invalid promql query. Prometheus documents them in promql/promqltest/testdata/native_histograms.test:

Test native histogram with trim operators (</: TRIM_UPPER, >/: TRIM_LOWER)

Current state (verified)

No token at all. grep -c TRIM is 0 in both src/parser/token.rs and src/parser/promql.y, on the asap branch and on GreptimeTeam upstream main. This is a from-scratch port of a recent Prometheus (Go) feature.

Work

  • Lexer: recognize the two-character operators </ (TRIM_UPPER) and >/ (TRIM_LOWER). Care needed: < / > / / are all existing single-char tokens, so the lexer must look ahead.
  • Grammar: productions for expr </ expr / expr >/ expr.
  • AST + operator enum entries mirroring the Go TRIM_UPPER / TRIM_LOWER.

Corpus impact

110 rejections — the single largest parser gap.

Constraint

All changes on the asap branch; no upstream operations.

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