Skip to content

ci(promql): Add extended PromQL support via vendored compliance tests. - #120849

Merged
nikitamikhaylov merged 17 commits into
ClickHouse:masterfrom
JTCunning:jtcunning/promql-extended-support
Sep 22, 2026
Merged

nikitamikhaylov merged 17 commits into
ClickHouse:masterfrom
JTCunning:jtcunning/promql-extended-support

Conversation

@JTCunning

@JTCunning JTCunning commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

This vendors tests from prometheus/prometheus as the canonical way to test for compliance.

Unfortunately, prometheus/compliance tests for a subset of functions, and is not an accurate representation of a "fully compatible drop-in replacement."

Instead of replacing the original tests and showing a regression, I've opted for adding a second line to the compliance report.

This PR looks huge because of the vendored files. It's pretty small otherwise.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

N/A


Workflow [PR]
Sync PR [sync-upstream/pr/120849]

Version info

  • Merged into: 26.10.1.465-master (included in 26.10 and later)

Vendor 14 stable engine-test files from prometheus/prometheus at
3da2514eff5ce503de2e8f355cae8ca58a2a35ed. CI reads only this snapshot.
Parse load, clear, eval, expected failures, and ordered results from
the pinned snapshot. Give every eval an explicit status.
Load each scenario into a dedicated `TimeSeries` table and compare
`prometheusQuery` / `prometheusQueryRange` output to expected results.
Write both suites into one schema version 2 JSON file.
Accept schema version 2 JSON, compare each suite to the same suite in
the master baseline, and omit an extended baseline when the old object
has no such suite.
@clickhouse-gh

clickhouse-gh Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8932f6d]

Summary: ✅


AI Review

Summary

This PR vendors a pinned upstream promqltest snapshot, adds the loader and runner for an extended PromQL support score, and wires that score into the PR comment and S3 reporting path. I re-checked the current head against the prior inline findings and the current code; the score-inflation issues around annotation cases, diagnostic-only failures, unsupported classification, command ordering, scalar and range comparisons, stale markers, and schema version 2 consumers are addressed, and I did not find new blockers or majors.

Missing context / blind spots
  • ⚠️ I did not rerun the full integration suite or the dedicated PromQL Compliance CI job locally in this review; confidence here is based on direct code inspection, the added unit coverage, and targeted loader-level probes against the vendored snapshot.
Final Verdict

✅ No new blocking review findings on the current PR head.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). labels Sep 18, 2026
@JTCunning JTCunning added can be tested Allows running workflows for external contributors comp-promql PromQL / time-series subsystem: TimeSeries storage engine, PromQL parser, PromQL-to-SQL converter... labels Sep 18, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

PromQL Compliance Report

Baseline: S3 master 8842ee48d

Suite Baseline Current Delta
Prometheus compliance 96.47% 96.47% +0.00%
Extended support (upstream engine tests) n/a 76.50% n/a
Suite Passed Failed Unsupported
Prometheus compliance 520 -> 520 (+0) 3 -> 3 (+0) 16 -> 16 (+0)
Extended support (upstream engine tests) n/a -> 560 (n/a) n/a -> 147 (n/a) n/a -> 25 (n/a)

Extended support (upstream engine tests): native-histogram exclusions: 149; excluded assertions: 248; upstream 3da2514eff5c.

Note: Prometheus compliance score is unchanged vs baseline.

Uploaded compliance JSON for this PR commit

@JTCunning
JTCunning marked this pull request as ready for review September 22, 2026 13:44
@nikitamikhaylov

Copy link
Copy Markdown
Member

@JTCunning not sure how to read this:

"value mismatch for {}: inf vs nan": 1,
"value mismatch for {}: inf vs 9.98846567431158e+307": 2,
"value mismatch for {}: -inf vs -9.98846567431158e+307": 2,
"value mismatch for {'label': 'c'}: 0.0 vs nan": 4,
"value mismatch for {'label': 'a'}: 0.0 vs nan": 4,
"value mismatch for {}: 0.0 vs nan": 4,

substitution failed somewhere.

@nikitamikhaylov
nikitamikhaylov added this pull request to the merge queue Sep 22, 2026
Merged via the queue into ClickHouse:master with commit 59ccf5f Sep 22, 2026
176 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 22, 2026
pull Bot pushed a commit to Dream-hu/ClickHouse that referenced this pull request Sep 24, 2026
… process per statement

test_prometheus_protocols/test_compliance.py::test_promql_extended_support hits the 900s
pytest-timeout on sanitizer flavours (Integration tests (amd_msan, 6/8): 4 FAIL against 349 OK
over 7 days, plus one FAIL on amd_asan_ubsan, db disk, 6/8), which reds master and unrelated
contributors' PRs. The suite was added in ClickHouse#120849.

The test issues 983 statements over the vendored upstream promqltest corpus: one TRUNCATE per
scenario, one INSERT per LOAD block, one SELECT per eval. Each went through node.query(), which
forks a clickhouse client process and waits for it to exit, and ci/jobs/integration_test_job.py
points CLICKHOUSE_TESTS_CLIENT_BIN_PATH at the same sanitizer-instrumented binary as the server,
so every statement pays an instrumented process bootstrap. In the failing master run (sha
8db8b8d) 461s of the 900s window was spent outside any server connection, 51% of the wall clock,
and the full corpus projects to 996s. It is not one heavy query: the slowest single query there
took 10.9s and no inter-statement gap exceeded 11.5s.

Sending those statements over the node's HTTP interface removes the process bootstrap and nothing
else. The corpus, the statements and the comparisons are unchanged, and the two module-level DDL
statements keep using the native protocol so the test still exercises it. Measured on one debug
binary, before and after: test body 117.53s to 24.92s, statements reaching the native protocol
1118 to 135, client process launches 988 to 5, with all eight pinned suites.extended_support
counters byte-identical (566 passed, 141 failed, 25 unsupported of 732). The 900s budget is kept
rather than raised, so it stays a guard on PromQL evaluation cost, at roughly 1.8x projected
margin on the worst run observed.

http_wait_end_of_query=1 and the body-tail check are both needed. compare_eval treats a non-None
error as the only thing that can make an expect_fail eval pass or classify an eval unsupported,
while http_query_and_get_answer_with_error decides success on the HTTP status alone, and
ClickHouse can answer 200 with the exception appended to the response body once part of the
response has been flushed. The setting holds the response server-side until the query resolves so
a failure arrives as an error status, and the regex covers the residual shape, which does
reproduce on this build when send_progress_in_http_headers commits the headers early. Without
them the 13 expect_fail evals would have flipped to failed with nothing turning red.
@clickhouse-gh clickhouse-gh Bot removed the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-promql PromQL / time-series subsystem: TimeSeries storage engine, PromQL parser, PromQL-to-SQL converter... pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants