Basic support for the PromQL dialect#75036
Basic support for the PromQL dialect#75036nikitamikhaylov merged 14 commits intoClickHouse:masterfrom
Conversation
852673f to
89026e0
Compare
|
This is an automated comment for commit d0715d6 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
1261a10 to
d0715d6
Compare
|
This does feel somewhat unusual, as ClickHouse have 2 additional dialects (with others in mind), and they act as first level citizen(Kusto/PRQL). Any other reasons to wrap it in function? |
Yes, PromQL support in ClickHouse can be implemented as a dialect too. Though it requires specifying a |
| METRIC_NAME : [a-z_:] [a-z0-9_:]*; | ||
| LABEL_NAME : [a-z_] [a-z0-9_]*; | ||
|
|
There was a problem hiding this comment.
Since v3, all valid utf-8 chars are allowed https://prometheus.io/blog/2024/11/14/prometheus-3-0/#utf-8-support
|
@vitlibar curious if/how range vectors and resets will be handled. |
|
Hm, PromQL doesn't have concept of table, right. In that case, can it be just one more "endpoint", and PromQL will act like postgresql/mysql interfaces of ClickHouse. (with difference that it's not only protocol but also language) May be, it even make sense to have "default" prometheus query endpoint, which will point to data from metrics/async_metrics/events _log tables. (but this req some adoption of them under TimeSeries schema, so it's like separate feature for now) |
|
Dear @vitlibar, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
1 similar comment
|
Dear @vitlibar, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
d0715d6 to
eed38fc
Compare
eed38fc to
0c74981
Compare
|
Workflow [PR], commit [fafb184] Summary: ❌
|
0c74981 to
3ec3134
Compare
4f033ed to
838954f
Compare
9967d57 to
6da7128
Compare
ed23964 to
296aba1
Compare
…IdToTagsGroup(), timeSeriesTagsGroupToTags().
…e_series_table == true.
296aba1 to
93ca6d5
Compare
|
This PR is ready for review, @GrigoryPervakov please take a look. |
93ca6d5 to
18d019b
Compare
src/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesHelpers.cpp
Show resolved
Hide resolved
| } | ||
|
|
||
| /// The argument can be nullable. | ||
| if (const auto * nullable_column = checkAndGetColumn<ColumnNullable>(&column_tags_array)) |
There was a problem hiding this comment.
Can you add an example here?
Map/Array cannot be Nullable, and I can't find an example when this code works
There was a problem hiding this comment.
I corrected this code in my new PR #93234. Map/Array can't be nullable, but instead of Map or Array just literal NULL can be passed to this argument.
There was a problem hiding this comment.
Let's add some tests for these functions, maybe smth like this could be useful to ensure it is consistent
SELECT
timeSeriesIdToTags(stored_id) = timeSeriesTagsGroupToTags(timeSeriesIdToTagsGroup(stored_id))
FROM (
SELECT timeSeriesStoreTags(id , tags, '__name__', metric_name) as stored_id
FROM <some timeseries tags table>
) ORDER BY group
There was a problem hiding this comment.
I added a test named 03779_time_series_tags_functions.sql in my new PR #93234 to test such functions.
|
Flaky test |
e59fe89
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Basic support for the PromQL dialect is added. To use it, set
dialect='promql'in clickhouse-client, point it to the TimeSeries table using the settingpromql_table_name='X'and execute queries likerate(ClickHouseProfileEvents_ReadCompressedBytes[1m])[5m:1m].In addition you can wrap the PromQL query with SQL:
SELECT * FROM prometheusQuery('up', ...);.So far only functions
rate,deltaandincreaseare supported. No unary/binary operators. No HTTP API.