diff --git a/pkg/logql/log/dedup_filter.go b/pkg/logql/log/dedup_filter.go index 4cc12bf3a1761..0825d22d4c13f 100644 --- a/pkg/logql/log/dedup_filter.go +++ b/pkg/logql/log/dedup_filter.go @@ -5,16 +5,16 @@ import ( ) type LineDedupFilter struct { - labels map[string]interface{} + labels map[string]struct{} inverted bool hashLookup map[uint64]struct{} } func NewLineDedupFilter(labelFilters []string, inverted bool) *LineDedupFilter { // create a map of labelFilters for O(1) lookups instead of O(n) - var filterMap = make(map[string]interface{}) + var filterMap = make(map[string]struct{}) for _, group := range labelFilters { - filterMap[group] = nil + filterMap[group] = struct{}{} } return &LineDedupFilter{ diff --git a/pkg/logql/log/dedup_filter_test.go b/pkg/logql/log/dedup_filter_test.go index e0b0d2d30451d..5ba3801015da0 100644 --- a/pkg/logql/log/dedup_filter_test.go +++ b/pkg/logql/log/dedup_filter_test.go @@ -119,7 +119,6 @@ func Test_Deduplication(t *testing.T) { for _, entry := range entries { b := NewBaseLabelsBuilder().ForLabels(*entry.lbs, entry.lbs.Hash()) - b.Reset() if line, ok := d.Process(entry.line, b); ok { outLines = append(outLines, line) @@ -142,7 +141,6 @@ func Benchmark_Deduplication(b *testing.B) { } lbs := NewBaseLabelsBuilder().ForLabels(l, l.Hash()) - lbs.Reset() line := randomLine(10) diff --git a/pkg/logql/parser_test.go b/pkg/logql/parser_test.go index 6f4bdad71e91f..33df96a097f51 100644 --- a/pkg/logql/parser_test.go +++ b/pkg/logql/parser_test.go @@ -747,20 +747,20 @@ func TestParse(t *testing.T) { }, { // missing "by" clause - in: `{foo="bar"} dedup (label)`, + in: `{foo="bar"} | dedup (label)`, err: ParseError{ - msg: "syntax error: unexpected dedup", + msg: "syntax error: unexpected (, expecting by or without", line: 1, - col: 13, + col: 21, }, }, { // misspelling of "dedup" - in: `{foo="bar"} dedupe by (label)`, + in: `{foo="bar"} | dedupe by (label)`, err: ParseError{ - msg: "syntax error: unexpected IDENTIFIER", + msg: "syntax error: unexpected by", line: 1, - col: 13, + col: 22, }, }, {