mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-10 15:22:56 +00:00
test: flow rebuild (#5162)
* tests: rebuild flow * tests: more rebuild * tests: restart * chore: drop clean
This commit is contained in:
578
tests/cases/standalone/common/flow/flow_rebuild.result
Normal file
578
tests/cases/standalone/common/flow/flow_rebuild.result
Normal file
@@ -0,0 +1,578 @@
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 2 |
|
||||
+----------+
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- combination of different order of rebuild input table/flow
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 2 |
|
||||
+----------+
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
-- this is expected to be the same as above("2") since the new `input_basic` table
|
||||
-- have different table id, so is a different table
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 2 |
|
||||
+----------+
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- recreate flow so that it use new table id
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(25, "2021-07-01 00:00:01.700");
|
||||
|
||||
Affected Rows: 3
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
-- 3 is also expected, since flow don't have persisent state
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 3 |
|
||||
+----------+
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 2 |
|
||||
+----------+
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(25, "2021-07-01 00:00:01.700");
|
||||
|
||||
Affected Rows: 3
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 3 |
|
||||
+----------+
|
||||
|
||||
-- test again, this time with db restart
|
||||
DROP TABLE input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 2 |
|
||||
+----------+
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- combination of different order of rebuild input table/flow
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 2 |
|
||||
+----------+
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(26, "2021-07-01 00:00:02.000");
|
||||
|
||||
Affected Rows: 3
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
-- this is expected to be the same as above("2") since the new `input_basic` table
|
||||
-- have different table id, so is a different table
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 2 |
|
||||
+----------+
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- recreate flow so that it use new table id
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(25, "2021-07-01 00:00:01.700");
|
||||
|
||||
Affected Rows: 3
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
-- 3 is also expected, since flow don't have persisent state
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 3 |
|
||||
+----------+
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
Affected Rows: 2
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 2 |
|
||||
+----------+
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(25, "2021-07-01 00:00:01.700");
|
||||
|
||||
Affected Rows: 3
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
+-----------------------------------------+
|
||||
| ADMIN FLUSH_FLOW('test_wildcard_basic') |
|
||||
+-----------------------------------------+
|
||||
| FLOW_FLUSHED |
|
||||
+-----------------------------------------+
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
+----------+
|
||||
| wildcard |
|
||||
+----------+
|
||||
| 3 |
|
||||
+----------+
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
319
tests/cases/standalone/common/flow/flow_rebuild.sql
Normal file
319
tests/cases/standalone/common/flow/flow_rebuild.sql
Normal file
@@ -0,0 +1,319 @@
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
-- combination of different order of rebuild input table/flow
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
-- this is expected to be the same as above("2") since the new `input_basic` table
|
||||
-- have different table id, so is a different table
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
-- recreate flow so that it use new table id
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(25, "2021-07-01 00:00:01.700");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
-- 3 is also expected, since flow don't have persisent state
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP TABLE input_basic;
|
||||
DROP FLOW test_wildcard_basic;
|
||||
DROP TABLE out_basic;
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(25, "2021-07-01 00:00:01.700");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
-- test again, this time with db restart
|
||||
DROP TABLE input_basic;
|
||||
DROP TABLE out_basic;
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
-- combination of different order of rebuild input table/flow
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(26, "2021-07-01 00:00:02.000");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
-- this is expected to be the same as above("2") since the new `input_basic` table
|
||||
-- have different table id, so is a different table
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
-- recreate flow so that it use new table id
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(25, "2021-07-01 00:00:01.700");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
-- 3 is also expected, since flow don't have persisent state
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP TABLE input_basic;
|
||||
DROP FLOW test_wildcard_basic;
|
||||
DROP TABLE out_basic;
|
||||
|
||||
CREATE TABLE input_basic (
|
||||
number INT,
|
||||
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY(number),
|
||||
TIME INDEX(ts)
|
||||
);
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500");
|
||||
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
DROP TABLE out_basic;
|
||||
|
||||
CREATE FLOW test_wildcard_basic sink TO out_basic AS
|
||||
SELECT
|
||||
COUNT(*) as wildcard
|
||||
FROM
|
||||
input_basic;
|
||||
|
||||
-- SQLNESS ARG restart=true
|
||||
INSERT INTO
|
||||
input_basic
|
||||
VALUES
|
||||
(23, "2021-07-01 00:00:01.000"),
|
||||
(24, "2021-07-01 00:00:01.500"),
|
||||
(25, "2021-07-01 00:00:01.700");
|
||||
|
||||
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
||||
ADMIN FLUSH_FLOW('test_wildcard_basic');
|
||||
|
||||
SELECT wildcard FROM out_basic;
|
||||
|
||||
DROP FLOW test_wildcard_basic;
|
||||
|
||||
DROP TABLE input_basic;
|
||||
|
||||
DROP TABLE out_basic;
|
||||
Reference in New Issue
Block a user