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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bindingLogical-to-physical binding and implementation selectionbugSomething 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