mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 05:12:54 +00:00
* fix: print the output message of the error in admin fn macro (#6994) Signed-off-by: evenyag <realevenyag@gmail.com> Signed-off-by: discord9 <discord9@163.com> * fix: make EXPIRE (keyword) parsing case-insensitive, when creating flow (#6997) fix: make EXPIRE keyword case-insensitive in CREATE FLOW parser Signed-off-by: Shyamnatesan <shyamnatesan21@gmail.com> Signed-off-by: discord9 <discord9@163.com> * fix: promql range function has incorrect timestamps (#7006) * fix: promql range function has incorrect timestamps Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * simplify Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Signed-off-by: discord9 <discord9@163.com> * fix: incorrect timestamp resolution in information_schema.partitions table (#7004) * fix: incorrect timestamp resolution in information_schema.partitions table Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * use second for all fields in partitions table Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * update sqlness result Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Signed-off-by: discord9 <discord9@163.com> * fix: match promql column reference in case sensitive way (#7013) Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Signed-off-by: discord9 <discord9@163.com> * fix: group by expr not as column in step aggr (#7008) * fix: group by expr not as column Signed-off-by: discord9 <discord9@163.com> * test: dist analyzer date_bin Signed-off-by: discord9 <discord9@163.com> * ???fix wip Signed-off-by: discord9 <discord9@163.com> * fix: deduce using correct input fields Signed-off-by: discord9 <discord9@163.com> * refactor: clearer wrapper Signed-off-by: discord9 <discord9@163.com> * chore: update sqlness Signed-off-by: discord9 <discord9@163.com> * chore: per review Signed-off-by: discord9 <discord9@163.com> * chore: per review Signed-off-by: discord9 <discord9@163.com> * chore: rm todo Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> * fix: skip placeholder when partition columns (#7020) Signed-off-by: discord9 <discord9@163.com> * chore: add function for getting started on metasrv (#7022) Signed-off-by: shuiyisong <xixing.sys@gmail.com> Signed-off-by: discord9 <discord9@163.com> * fix: not step when aggr have order by/filter (#7015) * fix: not applied Signed-off-by: discord9 <discord9@163.com> * chore: per review Signed-off-by: discord9 <discord9@163.com> * test: confirm order by not push down Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> * feat: supports expression in TQL params (#7014) * feat: supports expression in TQL params Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: by cr comments Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: comment Signed-off-by: Dennis Zhuang <killme2008@gmail.com> * chore: by cr comments Signed-off-by: Dennis Zhuang <killme2008@gmail.com> --------- Signed-off-by: Dennis Zhuang <killme2008@gmail.com> Signed-off-by: discord9 <discord9@163.com> * feat: update dashboard to v0.11.6 (#7026) Co-authored-by: ZonaHex <ZonaHex@users.noreply.github.com> Signed-off-by: discord9 <discord9@163.com> * fix: step aggr merge phase not order nor filter (#6998) * fix: not order Signed-off-by: discord9 <discord9@163.com> * test: redacted Signed-off-by: discord9 <discord9@163.com> * feat: fix up state wrapper Signed-off-by: discord9 <discord9@163.com> * df last_value state not as promised! Signed-off-by: discord9 <discord9@163.com> * fix?: could fix better Signed-off-by: discord9 <discord9@163.com> * test: unstable result Signed-off-by: discord9 <discord9@163.com> * fix: work around by fixing state Signed-off-by: discord9 <discord9@163.com> * chore: after rebase fix Signed-off-by: discord9 <discord9@163.com> * chore: finish some todo Signed-off-by: discord9 <discord9@163.com> * chore: per copilot Signed-off-by: discord9 <discord9@163.com> * refactor: not fix but just notify mismatch Signed-off-by: discord9 <discord9@163.com> * chore: warn -> debug state mismatch Signed-off-by: discord9 <discord9@163.com> * chore: refine error msg Signed-off-by: discord9 <discord9@163.com> * test: sqlness add last_value date_bin test Signed-off-by: discord9 <discord9@163.com> * ?: substrait order by decode failure Signed-off-by: discord9 <discord9@163.com> * unit test reproduce that Signed-off-by: discord9 <discord9@163.com> * feat: support state wrapper's order serde in substrait Signed-off-by: discord9 <discord9@163.com> * refactor: stuff Signed-off-by: discord9 <discord9@163.com> * test: standalone/distributed different exec Signed-off-by: discord9 <discord9@163.com> * fmt Signed-off-by: discord9 <discord9@163.com> * chore: per review Signed-off-by: discord9 <discord9@163.com> * refactor: closure Signed-off-by: discord9 <discord9@163.com> * test: first value order by Signed-off-by: discord9 <discord9@163.com> * refactor: per cr Signed-off-by: discord9 <discord9@163.com> * feat: ScanHint last_value last row selector Signed-off-by: discord9 <discord9@163.com> * docs: per cr Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> * chore: bump version to 0.17.2 Signed-off-by: WenyXu <wenymedia@gmail.com> Signed-off-by: discord9 <discord9@163.com> * chore: not warning Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com> Signed-off-by: discord9 <discord9@163.com> Signed-off-by: Shyamnatesan <shyamnatesan21@gmail.com> Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Signed-off-by: shuiyisong <xixing.sys@gmail.com> Signed-off-by: Dennis Zhuang <killme2008@gmail.com> Signed-off-by: WenyXu <wenymedia@gmail.com> Co-authored-by: Yingwen <realevenyag@gmail.com> Co-authored-by: shyam <43544082+Shyamnatesan@users.noreply.github.com> Co-authored-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: discord9 <55937128+discord9@users.noreply.github.com> Co-authored-by: shuiyisong <113876041+shuiyisong@users.noreply.github.com> Co-authored-by: dennis zhuang <killme2008@gmail.com> Co-authored-by: ZonaHe <zonahe@qq.com> Co-authored-by: ZonaHex <ZonaHex@users.noreply.github.com> Co-authored-by: discord9 <discord9@163.com>
345 lines
9.4 KiB
SQL
345 lines
9.4 KiB
SQL
create table t (
|
|
ts timestamp time index,
|
|
host string primary key,
|
|
not_pk string,
|
|
val double,
|
|
) with (append_mode='true');
|
|
|
|
insert into t values
|
|
(0, 'a', '🌕', 1.0),
|
|
(1, 'b', '🌖', 2.0),
|
|
(2, 'a', '🌗', 3.0),
|
|
(3, 'c', '🌘', 4.0),
|
|
(4, 'a', '🌑', 5.0),
|
|
(5, 'b', '🌒', 6.0),
|
|
(6, 'a', '🌓', 7.0),
|
|
(7, 'c', '🌔', 8.0),
|
|
(8, 'd', '🌕', 9.0);
|
|
|
|
admin flush_table('t');
|
|
|
|
select
|
|
last_value(host order by ts),
|
|
last_value(not_pk order by ts),
|
|
last_value(val order by ts)
|
|
from t
|
|
group by host
|
|
order by host;
|
|
|
|
-- repeat the query again, ref: https://github.com/GreptimeTeam/greptimedb/issues/4650
|
|
select
|
|
last_value(host order by ts),
|
|
last_value(not_pk order by ts),
|
|
last_value(val order by ts)
|
|
from t
|
|
group by host
|
|
order by host;
|
|
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
explain select
|
|
last_value(host order by ts),
|
|
last_value(not_pk order by ts),
|
|
last_value(val order by ts)
|
|
from t
|
|
group by host;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
explain analyze
|
|
select
|
|
last_value(host order by ts),
|
|
last_value(not_pk order by ts),
|
|
last_value(val order by ts)
|
|
from t
|
|
group by host;
|
|
|
|
select last_value(ts order by ts) from t;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
explain select last_value(ts order by ts) from t;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
explain analyze
|
|
select last_value(ts order by ts) from t;
|
|
|
|
drop table t;
|
|
|
|
create table t (
|
|
ts timestamp time index,
|
|
host string primary key,
|
|
not_pk string,
|
|
val double,
|
|
)
|
|
PARTITION ON COLUMNS (host) (
|
|
host < 'b',
|
|
host >= 'b' AND host < 'd',
|
|
host >= 'd'
|
|
);
|
|
|
|
insert into t values
|
|
(0, 'a', '🌕', 1.0),
|
|
(1, 'b', '🌖', 2.0),
|
|
(2, 'a', '🌗', 3.0),
|
|
(3, 'c', '🌘', 4.0),
|
|
(4, 'a', '🌑', 5.0),
|
|
(5, 'b', '🌒', 6.0),
|
|
(6, 'a', '🌓', 7.0),
|
|
(7, 'c', '🌔', 8.0),
|
|
(8, 'd', '🌕', 9.0);
|
|
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(not_pk order by ts),
|
|
last_value(val order by ts)
|
|
from t
|
|
group by host
|
|
order by ordered_host;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
explain select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(not_pk order by ts),
|
|
last_value(val order by ts)
|
|
from t
|
|
group by host
|
|
order by ordered_host;
|
|
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
explain analyze
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(not_pk order by ts),
|
|
last_value(val order by ts)
|
|
from t
|
|
group by host
|
|
order by ordered_host;
|
|
|
|
select last_value(ts order by ts) from t;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
explain select last_value(ts order by ts) from t;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
explain analyze
|
|
select last_value(ts order by ts) from t;
|
|
|
|
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts),
|
|
last_value(ts order by ts),
|
|
date_bin('5ms'::INTERVAL, ts) as time_window
|
|
from t
|
|
group by time_window
|
|
order by time_window, ordered_host;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
explain
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts),
|
|
last_value(ts order by ts),
|
|
date_bin('5ms'::INTERVAL, ts) as time_window
|
|
from t
|
|
group by time_window
|
|
order by time_window, ordered_host;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
explain analyze
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts),
|
|
last_value(ts order by ts),
|
|
date_bin('5ms'::INTERVAL, ts) as time_window
|
|
from t
|
|
group by time_window
|
|
order by time_window, ordered_host;
|
|
|
|
drop table t;
|
|
|
|
CREATE TABLE phy (ts timestamp time index, val double, host string primary key)
|
|
PARTITION ON COLUMNS (host) (
|
|
host < 'b',
|
|
host >= 'b' AND host < 'd',
|
|
host >= 'd'
|
|
) engine=metric with ("physical_metric_table" = "");
|
|
|
|
CREATE TABLE t1 (ts timestamp time index, val double, host string primary key) engine = metric with ("on_physical_table" = "phy");
|
|
|
|
|
|
insert into
|
|
t1(ts, val, host)
|
|
values
|
|
(0, 1.0, 'a'),
|
|
(1, 2.0, 'b'),
|
|
(2, 3.0, 'a'),
|
|
(3, 4.0, 'c'),
|
|
(4, 5.0, 'a'),
|
|
(5, 6.0, 'b'),
|
|
(6, 7.0, 'a'),
|
|
(7, 8.0, 'c'),
|
|
(8, 9.0, 'd');
|
|
|
|
select last_value(ts order by ts) from t1;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
explain
|
|
select last_value(ts order by ts) from t1;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
explain analyze
|
|
select last_value(ts order by ts) from t1;
|
|
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts)
|
|
from t1
|
|
group by host
|
|
order by ordered_host;
|
|
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
explain
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts)
|
|
from t1
|
|
group by host
|
|
order by ordered_host;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
explain analyze
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts)
|
|
from t1
|
|
group by host
|
|
order by ordered_host;
|
|
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts),
|
|
last_value(ts order by ts),
|
|
date_bin('5ms'::INTERVAL, ts) as time_window
|
|
from t1
|
|
group by time_window
|
|
order by time_window, ordered_host;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
explain
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts),
|
|
last_value(ts order by ts),
|
|
date_bin('5ms'::INTERVAL, ts) as time_window
|
|
from t1
|
|
group by time_window
|
|
order by time_window, ordered_host;
|
|
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (metrics.*) REDACTED
|
|
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
|
-- SQLNESS REPLACE region=\d+\(\d+,\s+\d+\) region=REDACTED
|
|
-- might write to different partitions
|
|
-- SQLNESS REPLACE "partition_count":\{(.*?)\} "partition_count":REDACTED
|
|
explain analyze
|
|
select
|
|
last_value(host order by ts) as ordered_host,
|
|
last_value(val order by ts),
|
|
last_value(ts order by ts),
|
|
date_bin('5ms'::INTERVAL, ts) as time_window
|
|
from t1
|
|
group by time_window
|
|
order by time_window, ordered_host;
|
|
|
|
drop table t1;
|
|
drop table phy;
|