Files
greptimedb/tests/cases/standalone/common/promql/quantile.sql
dennis zhuang 530ff53422 feat(promql): supports quantile and count_values (#5652)
* feat(promql): supports quantile

* fix: merge_batch

* chore: sqlness test

* test: unit tests

* feat: implements count_values

* fix: typo

* refactor: planner

* chore: apply review suggestions

---------

Co-authored-by: Yingwen <realevenyag@gmail.com>
2025-03-10 06:41:40 +00:00

34 lines
864 B
SQL

CREATE TABLE test (
ts timestamp(3) time index,
host STRING,
idc STRING,
val BIGINT,
PRIMARY KEY(host, idc),
);
INSERT INTO TABLE test VALUES
(0, 'host1', "idc1", 1),
(0, 'host2', "idc1", 2),
(0, 'host3', "idc2", 3),
(0, 'host4', "idc2", 4),
(5000, 'host1', "idc1", 5),
(5000, 'host2', "idc1", 6),
(5000, 'host3', "idc2", 7),
(5000, 'host4', "idc2", 8),
(10000, 'host1', "idc1", 9),
(10000, 'host2', "idc1", 10),
(10000, 'host3', "idc2", 11),
(10000, 'host4', "idc2", 12),
(15000, 'host1', "idc1", 13),
(15000, 'host2', "idc1", 14),
(15000, 'host3', "idc2", 15),
(15000, 'host4', "idc2", 16);
TQL EVAL (0, 15, '5s') quantile(0.5, test);
TQL EVAL (0, 15, '5s') quantile(0.5, test) by (idc);
TQL EVAL (0, 15, '5s') quantile(0.5, sum(test) by (idc));
DROP TABLE test;