Fix timestamp() method for vector selector inside paren (#8164)

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
This commit is contained in:
Ganesh Vernekar 2020-11-09 18:21:50 +05:30 committed by GitHub
parent f8ba0ed906
commit d30da66d77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -1027,6 +1027,7 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, storage.Warnings) {
// Matrix evaluation always returns the evaluation time,
// so this function needs special handling when given
// a vector selector.
unwrapParenExpr(&e.Args[0])
vs, ok := e.Args[0].(*parser.VectorSelector)
if ok {
return ev.rangeEval(func(v []parser.Value, enh *EvalNodeHelper) (Vector, storage.Warnings) {

View file

@ -300,6 +300,9 @@ eval instant at 0s timestamp(metric)
eval instant at 5s timestamp(metric)
{} 0
eval instant at 5s timestamp(((metric)))
{} 0
eval instant at 10s timestamp(metric)
{} 10