Repository navigation
Support PromQL functions changes() and resets() - #112352
Merged
nikitamikhaylov merged 3 commits intoJul 31, 2026
Merged
Conversation
Contributor
|
Workflow [PR], commit [554f782] Summary: ❌
AI ReviewSummaryThis PR wires Final Verdict✅ No blocking or major issues found in the current diff. |
The timeSeriesChangesToGrid/timeSeriesResetsToGrid aggregate functions and their factory registration already existed; only the PromQL-to-SQL dispatch table was missing the two entries. Both are value-transforming functions (their result has a different meaning than the input series), so drop_metric_name=true to match rate/increase/delta's convention.
valerypetrov
force-pushed
the
promql/wire-changes-resets
branch
from
July 29, 2026 00:02
bbb13fb to
58532cd
Compare
The dispatcher already accepts these two range functions but the supported-function tables in prometheusQuery.md and prometheusQueryRange.md still advertised the old set, so the docs continued to imply they were unsupported. Co-Authored-By: Claude Sonnet 5 <[email protected]>
increase() has been dispatched in applyFunctionOverRange.cpp and covered by test_evaluation.py for a while, but the Range support row in both prometheusQuery.md and prometheusQueryRange.md never listed it.
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 10/10 (100.00%) · Uncovered code |
nikitamikhaylov
approved these changes
Jul 31, 2026
Member
|
@groeneai, investigate the test failures, classify them, and link the PRs with fixes. |
Merged
via the queue into
ClickHouse:master
with commit Jul 31, 2026
13ff48c
176 of 179 checks passed
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #57545
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
PromQL: implemented functions
changes()andresets().Description
changes(v range-vector)andresets(v range-vector)were rejected withFunction 'changes' is not implemented/Function 'resets' is not implemented, even though the backing aggregate functions already existed and were registered.The
timeSeriesChangesToGrid/timeSeriesResetsToGridaggregate functions (AggregateFunctionTimeseriesChanges.h, templated on anis_resets_bool:curr != prevcounts as a change,curr < prevcounts as a reset) and their factory registration inAggregateFunctionTimeseriesHelpers.cppwere already present and correct. Only the PromQL-to-SQL dispatch table (applyFunctionOverRange.cpp'simpl_map) was missing the two entries.Added
changes/resetstoimpl_mapwithdrop_metric_name = true, matchingrate/increase/delta's convention (notlast_over_time'sfalse): both functions produce a transition count with a different meaning than the input series, so the metric name is dropped, same as Prometheus.Verified against Prometheus 3.5.0: identical results for
changes()/resets()over both a monotonically increasing series and a series with decreases (resets).Testing: new cases in
tests/integration/test_prometheus_protocols/test_evaluation.pycoveringchanges()andresets()over a plain range-vector selector, exercising both the "counts every transition" and "only counts decreases" semantics. This flips 12 queries of the PromQL compliance suite from unsupported to passed.