Skip to content

Nested topk/bottomk forms fail to plan or execute #796

Open

Description

@zzylol

Problem, by example

The topk series-identity fix (#794) made grouped topk answer whole series. While reviewing it, three nested topk forms were found to fail. They fail the same way before and after that fix:

Query Result
sum by (region) (topk(2, sum_over_time(data[1m]))) Stage 3 fails with NoValidCandidate([])
topk(2, sum_over_time(data[1m])) * 2 the frontend fails before Stage 2: "vector has no numeric sample"
count(bottomk(2, sum_over_time(data[1m]))) executes, but the answer is not a Float64 value

Prometheus answers all three: a sum of the top two series per region; each top series doubled; and the number of selected series.

Expected

All three plan and execute. Each answer equals Prometheus's.

Acceptance

An end-to-end test runs each query over a few series, checks the answer against hand-computed values, and checks it equals query_time_reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpromqlPromQL front-end lowering (L1→L2)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions