Summary
Arithmetic in duration positions parse-fails: changes(http_requests[26m+4m]) → unexpected character inside brackets: '+'; metric offset (2*2), count_over_time(m[step()+1ms]), sum_over_time(m[29s+1s:5s+5s]) likewise. Prometheus recently generalized durations to full expressions.
Current state (verified)
No DurationExpr in src/parser/ast.rs on the asap branch or GreptimeTeam upstream main (grep count 0). The lexer errors on any non-digit/unit character inside [...].
Note: step, range, min_of, max_of are already in the function table (added by c51beaf), but they only appear inside duration expressions, so they cannot be reached until this lands.
Work
- A
DurationExpr AST node (literal duration, step(), range(), and + - * / % ^ over them).
- Lexer: allow arithmetic tokens inside range / offset /
@ duration contexts.
- Grammar productions for duration expressions in
matrix_selector, subquery_expr, offset, @.
Corpus impact
51 rejections.
Constraint
All changes on the asap branch; no upstream operations.
Summary
Arithmetic in duration positions parse-fails:
changes(http_requests[26m+4m])→unexpected character inside brackets: '+';metric offset (2*2),count_over_time(m[step()+1ms]),sum_over_time(m[29s+1s:5s+5s])likewise. Prometheus recently generalized durations to full expressions.Current state (verified)
No
DurationExprinsrc/parser/ast.rson theasapbranch or GreptimeTeam upstreammain(grep count 0). The lexer errors on any non-digit/unit character inside[...].Note:
step,range,min_of,max_ofare already in the function table (added by c51beaf), but they only appear inside duration expressions, so they cannot be reached until this lands.Work
DurationExprAST node (literal duration,step(),range(), and+ - * / % ^over them).@duration contexts.matrix_selector,subquery_expr,offset,@.Corpus impact
51 rejections.
Constraint
All changes on the
asapbranch; no upstream operations.