Skip to content

[Bug] Nested histogram_quantile and histogram_quantiles still get no plan (executor compile) #911

Open

Description

@zzylol

Example

Once the top-level classic histogram_quantile compiles (#890), two related shapes still get no plan:

stage_pipeline --promql 'sum(histogram_quantile(0.9, sum by (le, job) (rate(http_request_duration_seconds_bucket[5m]))))' \
  --series-count 100 --enforce-accuracy-guarantees --out nested.json
stage_pipeline --promql 'histogram_quantiles(sum by (le) (rate(http_request_duration_seconds_bucket[5m])), "phi", 0.5, 0.9)' \
  --series-count 100 --enforce-accuracy-guarantees --out multi.json

Observed, from the review run of the #890 fix branch: stage3_plan_selection.selected is null and every candidate is rejected as executor_cannot_compile. The reasons are:

Query Rejection reason
sum(histogram_quantile(…)), max by (job) (histogram_quantile(…)) summary update column missing or ambiguous
histogram_quantiles(…, "phi", 0.5, 0.9) value operation has no native implementation

Expected: an exact plan that answers as Prometheus does. For the first query, that is the sum of the per-job p90s. For the second, it is one series per φ, with phi="0.5" and phi="0.9".

Why it happens

  • Nested aggregation. The quantile's output value column is named histogram_quantile, but the outer Aggregate resolves its value with named_column(input, &ColumnRef::SampleValue) in crates/executor/src/physical_planner/mod.rs, which looks for a column named value. A plain nested sum(sum by (job) (…)) has the same first-candidate rejection, but another of its candidates compiles. The histogram form has no other candidate.
  • histogram_quantiles. It lowers to a Concat of PromqlRelabel-wrapped branches. bind_operation has no case for that relabel/concat node.

docs/develop_docs/physical-compile-coverage.md stated that both shapes were covered. That was true only under the removed legacy execution wrapper.

Scope and acceptance

  • In scope: compile both shapes to exact operators.
  • Regression tests: plan_installable plus executor runs on controlled bucket counters, compared with hand-computed Prometheus values.

Activity

  1. added
    binding
    bug
    promql
    on Oct 23, 2026
  2. zzylol commented on Nov 17, 2026

    @zzylol
    ContributorAuthor

    Update: with #1246, histogram_quantiles(v, "q", φ1, φ2) compiles (its Concat of PromqlRelabel branches) and answers as Prometheus does: over buckets le 1: 4, le 2: 8, +Inf: 10, histogram_quantiles(x_bucket, "q", 0.5, 0.9) gives {q="0.5"} 1.25 and {q="0.9"} 2 (test promql_series_execution::histogram_quantiles_concatenates_relabelled_quantiles). The nested-aggregation half (sum(histogram_quantile(…)), value column named histogram_quantile) is still open.

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

    bindingbugpromql

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions