mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-06 21:32:58 +00:00
* feat: use flow batching engine broken: try using logical plan fix: use dummy catalog for logical plan fix: insert plan exec&sqlness grpc addr feat: use frontend instance in flownode in standalone feat: flow type in metasrv&fix: flush flow out of sync& column name alias tests: sqlness update tests: sqlness flow rebuild udpate chore: per review refactor: keep chnl mgr refactor: use catalog mgr for get table tests: use valid sql fix: add more check refactor: put flow type determine to frontend * chore: update proto * chore: update proto to main branch * fix: add locks for create/drop flow&docs: update docs * feat: flush_flow flush all ranges now * test: add align time window test * docs: explain `nodeid` use in check task * refactor: AddAutoColumnRewriter check for Projection * refactor: per review * fix: query without time window also clean dirty time window * chore: better logging * chore: add comments per review * refactor: per review * chore: per review * chore: per review rename args * refactor: per review partially * chore: update docs * chore: use better error variant * chore: better error variant * refactor: rename FlowWorkerManager to FlowStreamingEngine * rename again * refactor: per review * chore: rebase after #5963 merged * refactor: rename all flow_worker_manager occurs * docs: rm resolved TODO
201 lines
7.0 KiB
Plaintext
201 lines
7.0 KiB
Plaintext
-- test ttl = instant
|
|
CREATE TABLE distinct_basic (
|
|
number INT,
|
|
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY(number),
|
|
TIME INDEX(ts)
|
|
)WITH ('ttl' = 'instant');
|
|
|
|
Affected Rows: 0
|
|
|
|
-- should fail
|
|
-- SQLNESS REPLACE id=\d+ id=REDACTED
|
|
CREATE FLOW test_distinct_basic SINK TO out_distinct_basic AS
|
|
SELECT
|
|
DISTINCT number as dis
|
|
FROM
|
|
distinct_basic;
|
|
|
|
Error: 3001(EngineExecuteQuery), Unsupported: Source table `greptime.public.distinct_basic`(id=REDACTED) has instant TTL, Instant TTL is not supported under batching mode. Consider using a TTL longer than flush interval
|
|
|
|
ALTER TABLE distinct_basic SET 'ttl' = '5s';
|
|
|
|
Affected Rows: 0
|
|
|
|
CREATE FLOW test_distinct_basic SINK TO out_distinct_basic AS
|
|
SELECT
|
|
DISTINCT number as dis
|
|
FROM
|
|
distinct_basic;
|
|
|
|
Affected Rows: 0
|
|
|
|
-- SQLNESS ARG restart=true
|
|
INSERT INTO
|
|
distinct_basic
|
|
VALUES
|
|
(20, "2021-07-01 00:00:00.200"),
|
|
(20, "2021-07-01 00:00:00.200"),
|
|
(22, "2021-07-01 00:00:00.600");
|
|
|
|
Affected Rows: 3
|
|
|
|
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
|
ADMIN FLUSH_FLOW('test_distinct_basic');
|
|
|
|
+-----------------------------------------+
|
|
| ADMIN FLUSH_FLOW('test_distinct_basic') |
|
|
+-----------------------------------------+
|
|
| FLOW_FLUSHED |
|
|
+-----------------------------------------+
|
|
|
|
SHOW CREATE TABLE distinct_basic;
|
|
|
|
+----------------+-----------------------------------------------------------+
|
|
| Table | Create Table |
|
|
+----------------+-----------------------------------------------------------+
|
|
| distinct_basic | CREATE TABLE IF NOT EXISTS "distinct_basic" ( |
|
|
| | "number" INT NULL, |
|
|
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
|
|
| | TIME INDEX ("ts"), |
|
|
| | PRIMARY KEY ("number") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | WITH( |
|
|
| | ttl = '5s' |
|
|
| | ) |
|
|
+----------------+-----------------------------------------------------------+
|
|
|
|
SHOW CREATE TABLE out_distinct_basic;
|
|
|
|
+--------------------+---------------------------------------------------+
|
|
| Table | Create Table |
|
|
+--------------------+---------------------------------------------------+
|
|
| out_distinct_basic | CREATE TABLE IF NOT EXISTS "out_distinct_basic" ( |
|
|
| | "dis" INT NULL, |
|
|
| | "update_at" TIMESTAMP(3) NULL, |
|
|
| | "__ts_placeholder" TIMESTAMP(3) NOT NULL, |
|
|
| | TIME INDEX ("__ts_placeholder"), |
|
|
| | PRIMARY KEY ("dis") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | |
|
|
+--------------------+---------------------------------------------------+
|
|
|
|
SELECT
|
|
dis
|
|
FROM
|
|
out_distinct_basic;
|
|
|
|
+-----+
|
|
| dis |
|
|
+-----+
|
|
| 20 |
|
|
| 22 |
|
|
+-----+
|
|
|
|
SELECT number FROM distinct_basic;
|
|
|
|
+--------+
|
|
| number |
|
|
+--------+
|
|
| 20 |
|
|
| 22 |
|
|
+--------+
|
|
|
|
-- SQLNESS SLEEP 6s
|
|
ADMIN FLUSH_TABLE('distinct_basic');
|
|
|
|
+-------------------------------------+
|
|
| ADMIN FLUSH_TABLE('distinct_basic') |
|
|
+-------------------------------------+
|
|
| 0 |
|
|
+-------------------------------------+
|
|
|
|
INSERT INTO
|
|
distinct_basic
|
|
VALUES
|
|
(23, "2021-07-01 00:00:01.600");
|
|
|
|
Affected Rows: 1
|
|
|
|
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
|
ADMIN FLUSH_FLOW('test_distinct_basic');
|
|
|
|
+-----------------------------------------+
|
|
| ADMIN FLUSH_FLOW('test_distinct_basic') |
|
|
+-----------------------------------------+
|
|
| FLOW_FLUSHED |
|
|
+-----------------------------------------+
|
|
|
|
SHOW CREATE TABLE distinct_basic;
|
|
|
|
+----------------+-----------------------------------------------------------+
|
|
| Table | Create Table |
|
|
+----------------+-----------------------------------------------------------+
|
|
| distinct_basic | CREATE TABLE IF NOT EXISTS "distinct_basic" ( |
|
|
| | "number" INT NULL, |
|
|
| | "ts" TIMESTAMP(3) NOT NULL DEFAULT current_timestamp(), |
|
|
| | TIME INDEX ("ts"), |
|
|
| | PRIMARY KEY ("number") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | WITH( |
|
|
| | ttl = '5s' |
|
|
| | ) |
|
|
+----------------+-----------------------------------------------------------+
|
|
|
|
SHOW CREATE TABLE out_distinct_basic;
|
|
|
|
+--------------------+---------------------------------------------------+
|
|
| Table | Create Table |
|
|
+--------------------+---------------------------------------------------+
|
|
| out_distinct_basic | CREATE TABLE IF NOT EXISTS "out_distinct_basic" ( |
|
|
| | "dis" INT NULL, |
|
|
| | "update_at" TIMESTAMP(3) NULL, |
|
|
| | "__ts_placeholder" TIMESTAMP(3) NOT NULL, |
|
|
| | TIME INDEX ("__ts_placeholder"), |
|
|
| | PRIMARY KEY ("dis") |
|
|
| | ) |
|
|
| | |
|
|
| | ENGINE=mito |
|
|
| | |
|
|
+--------------------+---------------------------------------------------+
|
|
|
|
SELECT
|
|
dis
|
|
FROM
|
|
out_distinct_basic;
|
|
|
|
+-----+
|
|
| dis |
|
|
+-----+
|
|
| 20 |
|
|
| 22 |
|
|
| 23 |
|
|
+-----+
|
|
|
|
SELECT number FROM distinct_basic;
|
|
|
|
+--------+
|
|
| number |
|
|
+--------+
|
|
| 23 |
|
|
+--------+
|
|
|
|
DROP FLOW test_distinct_basic;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE distinct_basic;
|
|
|
|
Affected Rows: 0
|
|
|
|
DROP TABLE out_distinct_basic;
|
|
|
|
Affected Rows: 0
|
|
|