Skip to content

feat(promql): add executable exact bindings and full function smoke coverage - #728

Open
zzylol wants to merge 3 commits into
mainfrom
test/promql-exact-function-coverage
Open

zzylol wants to merge 3 commits into
mainfrom
test/promql-exact-function-coverage

Conversation

@zzylol

@zzylol zzylol commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Why

Developers need small, reproducible data and queries to compare ASAPPlanner/backend semantics with official Prometheus, with every aggregation and range-vector function bound to an executable plan.

What

Add a Prometheus 3.5.0 catalog covering 14 aggregation operators and 25 range-vector functions, 14 float series/64 samples, and 105 queries with explicit label/value expectations. Provide native exact binding/execution tests and a local HTTP fixture server.

How

Compile the real ASAPPlanner canonical tree into typed exact kernels and evaluate timestamped raw samples locally. The Python runner verifies catalog completeness and compares official promtool or HTTP results, including labels, NaN/Inf, and requested ordering. Sketch binding diagnostics remain separate.

Planner dependency: ProjectASAP/ASAPPlanner#413. Pin f27b16a747e5d7fcd70a5510075c0cd062f0dcea, which applies that fix on the backend's existing 029ff2f dependency to preserve its interfaces. No local path dependencies.

Before this PR

There was no complete function-name smoke corpus with executable bindings and official reference expectations; valid special quantile parameters could fail during lowering.

After this PR

Run cargo +1.98.0 test --locked -p data_plane --test promql_exact_execution to bind and execute all 105 cases locally. For example, equal-valued series still count separately, irate uses the final sample pair, and out-of-range quantile phi produces the defined infinity.

Evidence

See tools/promql-smoke/RESULTS.md for the recorded checks and README.md for reproduction. Screenshots and performance measurements: not applicable.

Verification

  • Official Prometheus 3.5.0 promtool: 84 stable + 21 experimental cases passed.
  • Backend native executor: 5 tests passed, including all 105 corpus queries.
  • Canonical exact binding: 105/105 BOUND_EXACT.
  • Local native HTTP: 105/105 expected results with asap_exact provenance; 105 range queries match per-step instant evaluation.
  • Planner frontend suites: 162 passed on both the planner PR and backend dependency commit.
  • Python comparator/coverage: 8 passed. Cargo formatting check passed.
  • Backend parser regressions: 7 passed. Targeted Clippy for the new test/examples passed with -D warnings.

The corpus test checks complete result sets, labels, numbers, and ordering. Focused regressions reject invalid snapshots/unsupported modifiers and protect equal-valued counts and negative sampling ratios. Python tests protect comparator and catalog coverage behavior.

Architectural decisions

Exact kernels require raw samples because existing sketches cannot recover all ordered-window semantics. The binder consumes canonical IR rather than reparsing or forwarding the original query. The HTTP example exercises the same library path without changing production routing.

Limitations and follow-up

Function-name coverage is pinned to Prometheus 3.5.0 float samples, not full PromQL conformance. Native histograms, staleness, offsets, @ modifiers, subqueries, and explicit vector matching are outside this path. Production adoption needs a raw-sample source and routing integration. Merge/reconcile the planner dependency before merging this PR.

Human review — do not complete with an agent

  • The MVP boundary is correct.
  • New conceptual layers or public interfaces are necessary.
  • The before/after description matches the intended product behavior.
  • Human reviewer:
  • Decision and rationale:

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant