mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-10 07:12:54 +00:00
* feat: supports value aliasing in TQL Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * fix: invalid checking Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: remove invalid checking Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test: add explain test Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: improve parser Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * test: add explain TQL-CTE Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
44 lines
1.1 KiB
SQL
44 lines
1.1 KiB
SQL
create table completion(
|
|
ts timestamp time index,
|
|
model string primary key,
|
|
val double
|
|
);
|
|
|
|
insert into completion values
|
|
(0, 'model-a', 10),
|
|
(5000, 'model-b', 20),
|
|
(10000, 'model-a', 30);
|
|
|
|
create table prompt(
|
|
ts timestamp time index,
|
|
model string primary key,
|
|
val double
|
|
);
|
|
|
|
insert into prompt values
|
|
(0, 'model-a', 100),
|
|
(5000, 'model-b', 200),
|
|
(10000, 'model-a', 300);
|
|
|
|
-- SQLNESS SORT_RESULT 3 1
|
|
tql eval(0, 10, '5s') sum(completion * 0.0015 / 1000) + sum(prompt / 1000 * 0.0015);
|
|
|
|
-- SQLNESS SORT_RESULT 3 1
|
|
tql eval(0, 10, '5s') sum(completion * 0.0015 / 1000) + sum(prompt * 0.0015 / 1000);
|
|
|
|
-- SQLNESS SORT_RESULT 3 1
|
|
tql eval(0, 10, '5s') sum(completion * 0.0015 / 1000) by (model) + sum(prompt * 0.0015 / 1000) by (model);
|
|
|
|
-- SQLNESS SORT_RESULT 3 1
|
|
tql eval(0, 10, '5s') sum(completion * 0.0015 / 1000) by (model) + sum(prompt * 0.0015 / 1000) by (model) AS result;
|
|
|
|
-- SQLNESS SORT_RESULT 3 1
|
|
tql eval(0, 10, '5s') sum(completion / 1000) + max(completion / 1000);
|
|
|
|
-- SQLNESS SORT_RESULT 3 1
|
|
tql eval(0, 10, '5s') sum(completion / 1000) + sum(completion / 1000);
|
|
|
|
drop table completion;
|
|
|
|
drop table prompt;
|