From 1e2f5e7294f1981f47faa6dc36cefeae6e0e683e Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 22 May 2024 18:39:53 +0200 Subject: [PATCH] wip --- lib/logstorage/parser.go | 6 ------ lib/logstorage/parser_test.go | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/logstorage/parser.go b/lib/logstorage/parser.go index e0804d4f2..04f229cdd 100644 --- a/lib/logstorage/parser.go +++ b/lib/logstorage/parser.go @@ -1016,9 +1016,6 @@ func parseFilterRegexp(lex *lexer, fieldName string) (filter, error) { } func parseFilterGT(lex *lexer, fieldName string) (filter, error) { - if fieldName == "" { - return nil, fmt.Errorf("'>' and '>=' must be prefixed with the field name") - } lex.nextToken() includeMinValue := false @@ -1048,9 +1045,6 @@ func parseFilterGT(lex *lexer, fieldName string) (filter, error) { } func parseFilterLT(lex *lexer, fieldName string) (filter, error) { - if fieldName == "" { - return nil, fmt.Errorf("'<' and '<=' must be prefixed with the field name") - } lex.nextToken() includeMaxValue := false diff --git a/lib/logstorage/parser_test.go b/lib/logstorage/parser_test.go index 93a360de0..6f4eaf2a8 100644 --- a/lib/logstorage/parser_test.go +++ b/lib/logstorage/parser_test.go @@ -505,6 +505,8 @@ func TestParseRangeFilter(t *testing.T) { f(`duration:range[100ns, 1y2w2.5m3s5ms]`, `duration`, 100, 1*nsecsPerYear+2*nsecsPerWeek+2.5*nsecsPerMinute+3*nsecsPerSecond+5*nsecsPerMillisecond) + f(`>=10`, ``, 10, inf) + f(`<=10`, ``, -inf, 10) f(`foo:>10.43`, `foo`, nextafter(10.43, inf), inf) f(`foo: > -10.43`, `foo`, nextafter(-10.43, inf), inf) f(`foo:>=10.43`, `foo`, 10.43, inf) @@ -750,6 +752,8 @@ func TestParseQuerySuccess(t *testing.T) { f(`foo: >= 10.5M`, `foo:>=10.5M`) f(`foo: < 10.5M`, `foo:<10.5M`) f(`foo: <= 10.5M`, `foo:<=10.5M`) + f(`foo:(>10 <=20)`, `foo:>10 foo:<=20`) + f(`>=10 <20`, `>=10 <20`) // re filter f("re('foo|ba(r.+)')", `re("foo|ba(r.+)")`)