mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-23 16:30:39 +00:00
* fix(promql): handle field column projection with correct qualifier * test: add sqlness tests
65 lines
3.0 KiB
Plaintext
65 lines
3.0 KiB
Plaintext
create table http_requests (
|
|
ts timestamp time index,
|
|
job string,
|
|
instance string,
|
|
env string,
|
|
greptime_value double,
|
|
primary key (job, instance, env)
|
|
);
|
|
|
|
Affected Rows: 0
|
|
|
|
insert into http_requests values
|
|
(3000000, "api", "0", "production", 100),
|
|
(3000000, "api", "0", "production", 200),
|
|
(3000000, "api", "0", "canary", 300),
|
|
(3000000, "api", "0", "canary", 400),
|
|
(3000000, "app", "2", "production", 500),
|
|
(3000000, "app", "2", "production", 600),
|
|
(3000000, "app", "2", "canary", 700),
|
|
(3000000, "app", "2", "canary", 800);
|
|
|
|
Affected Rows: 8
|
|
|
|
tql eval (3000, 3000, '1s') http_requests{job="api",instance="0",env="production"} + 5;
|
|
|
|
+-----+----------+------------+---------------------+-----------------------------+
|
|
| job | instance | env | ts | greptime_value + Float64(5) |
|
|
+-----+----------+------------+---------------------+-----------------------------+
|
|
| api | 0 | production | 1970-01-01T00:50:00 | 205.0 |
|
|
+-----+----------+------------+---------------------+-----------------------------+
|
|
|
|
tql eval (3000, 3000, '1s') http_requests{job="web",instance="1",env="production"} * 5;
|
|
|
|
++
|
|
++
|
|
|
|
tql eval (3000, 3000, '1s') http_requests{job="web",instance="1",env="production"} * 5 or http_requests{job="api",instance="0",env="production"} + 5;
|
|
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
| ts | env | greptime_value * Float64(5) | instance | job |
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
| 1970-01-01T00:50:00 | production | 205.0 | 0 | api |
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
|
|
tql eval (3000, 3000, '1s') http_requests{job="api",instance="0",env="production"} + 5 or http_requests{job="web",instance="1",env="production"} * 5;
|
|
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
| ts | env | greptime_value + Float64(5) | instance | job |
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
| 1970-01-01T00:50:00 | production | 205.0 | 0 | api |
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
|
|
tql eval (3000, 3000, '1s') http_requests{job="web",instance="1",env="production"} * 5 or http_requests{job="web",instance="2",env="production"} * 3 or http_requests{job="api",instance="0",env="production"} + 5;
|
|
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
| ts | env | greptime_value * Float64(5) | instance | job |
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
| 1970-01-01T00:50:00 | production | 205.0 | 0 | api |
|
|
+---------------------+------------+-----------------------------+----------+-----+
|
|
|
|
drop table http_requests;
|
|
|
|
Affected Rows: 0
|
|
|