mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
0b4c103edb
commit
db75ec4dac
2 changed files with 5 additions and 0 deletions
|
@ -929,6 +929,7 @@ func TestParseQuerySuccess(t *testing.T) {
|
||||||
count() if (is_admin:true or _msg:"foo bar"*) as foo,
|
count() if (is_admin:true or _msg:"foo bar"*) as foo,
|
||||||
sum(duration) if (host:in('foo.com', 'bar.com') and path:/foobar) as bar`,
|
sum(duration) if (host:in('foo.com', 'bar.com') and path:/foobar) as bar`,
|
||||||
`* | stats by (_time:1d offset -2h, f2) count(*) if (is_admin:true or "foo bar"*) as foo, sum(duration) if (host:in(foo.com,bar.com) path:"/foobar") as bar`)
|
`* | stats by (_time:1d offset -2h, f2) count(*) if (is_admin:true or "foo bar"*) as foo, sum(duration) if (host:in(foo.com,bar.com) path:"/foobar") as bar`)
|
||||||
|
f(`* | stats count() if () rows`, `* | stats count(*) if () as rows`)
|
||||||
|
|
||||||
// sort pipe
|
// sort pipe
|
||||||
f(`* | sort`, `* | sort`)
|
f(`* | sort`, `* | sort`)
|
||||||
|
|
|
@ -563,6 +563,10 @@ func parseIfFilter(lex *lexer) (filter, error) {
|
||||||
return nil, fmt.Errorf("unexpected token %q after 'if'; expecting '('", lex.token)
|
return nil, fmt.Errorf("unexpected token %q after 'if'; expecting '('", lex.token)
|
||||||
}
|
}
|
||||||
lex.nextToken()
|
lex.nextToken()
|
||||||
|
if lex.isKeyword(")") {
|
||||||
|
lex.nextToken()
|
||||||
|
return &filterNoop{}, nil
|
||||||
|
}
|
||||||
f, err := parseFilter(lex)
|
f, err := parseFilter(lex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot parse 'if' filter: %w", err)
|
return nil, fmt.Errorf("cannot parse 'if' filter: %w", err)
|
||||||
|
|
Loading…
Reference in a new issue