-
Notifications
You must be signed in to change notification settings - Fork 8k
PromQL: Simplify using decimals in PrometheusQueryTree #95223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PromQL: Simplify using decimals in PrometheusQueryTree #95223
Conversation
|
Workflow [PR], commit [e48a4a3] Summary: ❌
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR simplifies the handling of ranges and offsets in the Prometheus query parser by replacing DecimalField<DateTime64> and DecimalField<Decimal64> wrapper types with direct DateTime64 and Decimal64 primitive types throughout PrometheusQueryTree.
Changes:
- Replaced
ScalarLiteralandIntervalLiteralnodes with a singleScalarnode type - Removed
DecimalFieldwrappers in favor of storingDateTime64andDecimal64values directly - Updated parsing utilities to work with the new type system and take a
timestamp_scaleparameter
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/TableFunctions/TableFunctionPrometheusQuery.cpp | Retrieves timestamp scale from storage metadata and passes it to the query parser |
| src/Storages/TimeSeries/PrometheusQueryToSQL.cpp | Refactored to use primitive decimal types instead of DecimalField wrappers, simplified arithmetic operations |
| src/Storages/StoragePrometheusQuery.cpp | Added whitespace formatting |
| src/Parsers/Prometheus/tests/gtest_PrometheusQueryTree.cpp | Updated test expectations to reflect renamed node types and simplified output format |
| src/Parsers/Prometheus/PrometheusQueryTree.h | Modified node structure to store primitive types and added timestamp_scale field to the tree |
| src/Parsers/Prometheus/PrometheusQueryTree.cpp | Updated node implementations to use primitive types and pass tree context for dumping |
| src/Parsers/Prometheus/PrometheusQueryParsingUtil.h | Restructured parsing API to separate scalar, timestamp, and duration parsing with explicit scale parameters |
| src/Parsers/Prometheus/PrometheusQueryParsingUtil.cpp | Implemented new parsing functions with proper overflow checking and scale handling |
| src/Parsers/Prometheus/PrometheusQueryParsingUtil-antlr.cpp | Updated ANTLR-based parser to use new parsing utilities and store values directly in nodes |
| src/Core/DecimalFunctions.h | Added tryMultiplyAdd helper function for overflow-safe decimal arithmetic |
…<DateTime64> to simplify calculations.
…ifferent data types).
1af45ba to
e48a4a3
Compare
|
Ready for review |
8af83c4
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
PromQL: Simplify storing ranges and offsets in
PrometheusQueryTree,use
DateTime64instead ofDecimalField<DateTime64>.Part of #89356