Skip to content

Commit

Permalink
chore(storage/bloom/v1): update comments on bloom test (#14168)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfratto committed Sep 18, 2024
1 parent 02b26a8 commit 1b70866
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/storage/bloom/v1/bloom_tester.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,12 @@ func (sm stringMatcherTest) Matches(bloom filter.Checker) bool {
)

if !bloom.Test(rawKey) {
// The structured metadata key wasn't indexed. We pass the bloom test
// since we can only filter data out if the key was indexed but the value
// wasn't.
// The structured metadata key wasn't indexed. However, sm.matcher might be
// checking against a label which *does* exist, so we can't safely filter
// out this chunk.
//
// TODO(rfratto): The negative test here is a bit confusing, and the key
// presence test should likely be done higher up.
// presence test should likely be done higher up within FuseQuerier.
return true
}

Expand All @@ -408,12 +408,12 @@ func (sm stringMatcherTest) MatchesWithPrefixBuf(bloom filter.Checker, buf []byt
)

if !bloom.Test(prefixedKey) {
// The structured metadata key wasn't indexed for a prefix. We pass the
// bloom test since we can only filter data out if the key was indexed but
// the value wasn't.
// The structured metadata key wasn't indexed for a prefix. However,
// sm.matcher might be checking against a label which *does* exist, so we
// can't safely filter out this chunk.
//
// TODO(rfratto): The negative test here is a bit confusing, and the key
// presence test should likely be done higher up.
// presence test should likely be done higher up within FuseQuerier.
return true
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/storage/bloom/v1/bloom_tester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ func TestLabelMatchersToBloomTest(t *testing.T) {
query: `{app="fake"} | noexist="noexist"`,
match: true,
},
{
name: "ignore non-indexed key with empty value",
query: `{app="fake"} | noexist=""`,
match: true,
},
{
name: "ignore unsupported operator",
query: `{app="fake"} | trace_id=~".*noexist.*"`,
Expand Down

0 comments on commit 1b70866

Please sign in to comment.