PromQL: One path of evaluation in simple math functions#98235
Merged
alexey-milovidov merged 3 commits intoClickHouse:masterfrom Mar 1, 2026
Merged
Conversation
Contributor
vitlibar
commented
Feb 27, 2026
|
|
||
| case StoreMethod::CONST_SCALAR: | ||
| { | ||
| res.scalar_value = (impl_info->evaluate_with_const_argument)(argument.scalar_value); |
Member
Author
There was a problem hiding this comment.
Now we use the same path of evaluation for StoreMethod::CONST_SCALAR and StoreMethod::SINGLE_SCALAR.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies PromQL “simple math function” evaluation by removing the separate C++ evaluation path for constant scalars and instead always generating a ClickHouse SQL expression (so constants and non-constants use the same evaluation path). The integration tests are updated accordingly, including disabling some checks for functions where ClickHouse numeric results differ from Prometheus.
Changes:
- Refactor
applyMathSimpleFunction()to use a single SQL-building path forCONST_SCALARandSINGLE_SCALAR. - Simplify the function implementation map to only store the ClickHouse function name.
- Adjust integration tests for math functions (comment out
exp()andtanh()checks; changeln(vector(...))input value).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Storages/TimeSeries/PrometheusQueryToSQL/applyMathSimpleFunction.cpp |
Removes per-function C++ constant evaluation and unifies evaluation via ClickHouse function AST generation. |
tests/integration/test_prometheus_protocols/test_evaluation.py |
Updates math function expectations and disables some assertions for functions with known ClickHouse accuracy/consistency issues. |
src/Storages/TimeSeries/PrometheusQueryToSQL/applyMathSimpleFunction.cpp
Show resolved
Hide resolved
b3db572 to
bfddff6
Compare
tests/integration/test_prometheus_protocols/prometheus_test_utils.py
Outdated
Show resolved
Hide resolved
tests/integration/test_prometheus_protocols/prometheus_test_utils.py
Outdated
Show resolved
Hide resolved
tests/integration/test_prometheus_protocols/prometheus_test_utils.py
Outdated
Show resolved
Hide resolved
bfddff6 to
2987cda
Compare
32d9491 to
d19b528
Compare
tests/integration/test_prometheus_protocols/prometheus_test_utils.py
Outdated
Show resolved
Hide resolved
d19b528 to
b550ecd
Compare
b550ecd to
c6f0b78
Compare
alexey-milovidov
approved these changes
Mar 1, 2026
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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
PromQL: One path of evaluation in simple math functions