Skip to content

Conversation

benclive
Copy link
Contributor

What this PR does / why we need it:
Implements the approx_topk function on the querier directly, so it no longer requires the query-frontend to re-write it via the ShardMapper.

  • It is implemented using count_min_sketch as a sharded query is, but I added a step evaluator to process the samples instead of using the Downstreamer & Accumulator.
  • This fixes a panic when an approx_topk query is not sharded (e.g. it's within the minShardingLookback, or when there aren't any shards within the data) and the raw query is simply forwarded to the querier.

Tested locally to double check it works as expected.
image

@benclive benclive requested a review from a team as a code owner May 23, 2025 18:26
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@benclive benclive merged commit 7ca7c3b into main May 27, 2025
65 checks passed
@benclive benclive deleted the implement-approx-topk-on-querier branch May 27, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants