mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-29 06:04:06 +00:00
test(sql): cover persisted TQL views across restart
Signed-off-by: discord9 <discord9@163.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
name = "tql_view_persistence"
|
||||
reason = "Verify a TQL CREATE VIEW persisted as a Substrait plan, with its explicit lookback kept in the view definition, still evaluates correctly after a restart on a newer binary."
|
||||
introduced_by = "feat(sql): support TQL evaluation in persisted views"
|
||||
topologies = ["standalone", "distributed"]
|
||||
# setup.sql uses `CREATE VIEW ... AS TQL EVAL (start, end, step, lookback)`, which only
|
||||
# parses on builds that already carry this feature, so the from side has to stay on the
|
||||
# 1.4.0 line: today that means a same-candidate restart, and it starts covering real
|
||||
# release-to-release restarts from the first release that ships the syntax. `*` would
|
||||
# select older released binaries that cannot parse setup.sql. (The runner compares core
|
||||
# versions only, so this also admits other 1.4.0 prereleases.)
|
||||
from_range = [">=v1.4.0-alpha.0"]
|
||||
to_range = [">=v1.4.0-alpha.0"]
|
||||
features = ["view", "tql", "substrait", "table", "query"]
|
||||
owner = "query"
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Fixed-epoch samples: at the 1000s evaluation point, 600.001s is inside the explicit
|
||||
-- 10m lookback but already outside the default 5m one, and 1000.000s is the point itself.
|
||||
CREATE TABLE tql_view_source (
|
||||
ts TIMESTAMP TIME INDEX,
|
||||
val DOUBLE,
|
||||
series STRING PRIMARY KEY
|
||||
);
|
||||
|
||||
INSERT INTO tql_view_source VALUES
|
||||
(600001, 41, 'beyond_default_lookback'),
|
||||
(1000000, 12, 'at_eval');
|
||||
|
||||
ADMIN FLUSH_TABLE('tql_view_source');
|
||||
|
||||
CREATE VIEW tql_view_instant AS TQL EVAL (1000, 1000, '1s', '10m') tql_view_source;
|
||||
|
||||
CREATE VIEW tql_view_range AS TQL EVAL (1000, 1000, '1s', '10m') max_over_time(tql_view_source[2s]);
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Instant evaluation at 1000s honours the 10m lookback stored in the persisted view
|
||||
-- plan: 41 is 400s+ old but still selected, 12 sits exactly on the grid point.
|
||||
SELECT ts, series, val FROM tql_view_instant ORDER BY series;
|
||||
|
||||
SHOW CREATE VIEW tql_view_instant;
|
||||
|
||||
-- The range view binds its own 2s window, so only the sample at the evaluation point
|
||||
-- survives; the column names come from the plan persisted by the old binary.
|
||||
SELECT * FROM tql_view_range;
|
||||
Reference in New Issue
Block a user