2021-12-03 12:52:57 +00:00
|
|
|
-- Tags: no-parallel
|
|
|
|
|
2020-03-27 16:44:09 +00:00
|
|
|
SET allow_experimental_window_view = 1;
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP DATABASE IF EXISTS test_01048;
|
|
|
|
CREATE DATABASE test_01048 ENGINE=Ordinary;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.mt;
|
2022-01-18 09:20:15 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.mt_2;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
2021-12-03 12:52:57 +00:00
|
|
|
CREATE TABLE test_01048.mt(a Int32, b Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
|
2022-01-18 09:20:15 +00:00
|
|
|
CREATE TABLE test_01048.mt_2(a Int32, b Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
|
2020-03-27 16:44:09 +00:00
|
|
|
|
|
|
|
SELECT '---TUMBLE---';
|
|
|
|
SELECT '||---WINDOW COLUMN NAME---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count, tumbleEnd(wid) as wend FROM test_01048.mt GROUP BY tumble(timestamp, INTERVAL 1 SECOND) as wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
|
|
|
SELECT '||---WINDOW COLUMN ALIAS---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count, tumble(timestamp, INTERVAL '1' SECOND) AS wid FROM test_01048.mt GROUP BY wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
|
|
|
SELECT '||---IDENTIFIER---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count FROM test_01048.mt GROUP BY b, tumble(timestamp, INTERVAL '1' SECOND) AS wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count FROM test_01048.mt GROUP BY tumble(timestamp, INTERVAL '1' SECOND) AS wid, b;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
|
|
|
SELECT '||---FUNCTION---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count FROM test_01048.mt GROUP BY plus(a, b) as _type, tumble(timestamp, INTERVAL '1' SECOND) AS wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count FROM test_01048.mt GROUP BY tumble(timestamp, INTERVAL '1' SECOND) AS wid, plus(a, b);
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
2020-07-27 04:10:52 +00:00
|
|
|
SELECT '||---TimeZone---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count, tumble(timestamp, INTERVAL '1' SECOND, 'Asia/Shanghai') AS wid FROM test_01048.mt GROUP BY wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-07-27 04:10:52 +00:00
|
|
|
|
2022-01-18 09:20:15 +00:00
|
|
|
SELECT '||---DATA COLUMN ALIAS---';
|
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count, b as id FROM test_01048.mt GROUP BY id, tumble(timestamp, INTERVAL '1' SECOND);
|
2022-01-18 09:20:15 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
|
|
|
|
|
|
|
SELECT '||---JOIN---';
|
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(test_01048.mt.a), count(test_01048.mt_2.b), wid FROM test_01048.mt JOIN test_01048.mt_2 ON test_01048.mt.timestamp = test_01048.mt_2.timestamp GROUP BY tumble(test_01048.mt.timestamp, INTERVAL '1' SECOND) AS wid;
|
2022-01-18 09:20:15 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
|
|
|
|
2022-05-10 07:07:23 +00:00
|
|
|
SELECT '||---POPULATE JOIN---';
|
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-19 13:04:15 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory POPULATE AS SELECT count(test_01048.mt.a), count(test_01048.mt_2.b), wid FROM test_01048.mt JOIN test_01048.mt_2 ON test_01048.mt.timestamp = test_01048.mt_2.timestamp GROUP BY tumble(test_01048.mt.timestamp, INTERVAL '1' SECOND) AS wid;
|
2022-05-10 07:07:23 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
|
|
|
|
2020-03-27 16:44:09 +00:00
|
|
|
|
|
|
|
SELECT '---HOP---';
|
|
|
|
SELECT '||---WINDOW COLUMN NAME---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count, hopEnd(wid) as wend FROM test_01048.mt GROUP BY hop(timestamp, INTERVAL 1 SECOND, INTERVAL 3 SECOND) as wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
|
|
|
SELECT '||---WINDOW COLUMN ALIAS---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid FROM test_01048.mt GROUP BY wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
|
|
|
SELECT '||---IDENTIFIER---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count FROM test_01048.mt GROUP BY b, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count FROM test_01048.mt GROUP BY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid, b;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
|
|
|
SELECT '||---FUNCTION---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count FROM test_01048.mt GROUP BY plus(a, b) as _type, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
2022-01-18 09:20:15 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count FROM test_01048.mt GROUP BY hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid, plus(a, b);
|
2022-01-18 09:20:15 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
|
|
|
|
2020-07-27 04:10:52 +00:00
|
|
|
SELECT '||---TimeZone---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count, hopEnd(wid) as wend FROM test_01048.mt GROUP BY hop(timestamp, INTERVAL 1 SECOND, INTERVAL 3 SECOND, 'Asia/Shanghai') as wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-07-27 04:10:52 +00:00
|
|
|
|
2022-01-18 09:20:15 +00:00
|
|
|
SELECT '||---DATA COLUMN ALIAS---';
|
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(a) AS count, b as id FROM test_01048.mt GROUP BY id, hop(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND);
|
2022-01-18 09:20:15 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-07-27 04:10:52 +00:00
|
|
|
|
2022-01-18 09:20:15 +00:00
|
|
|
SELECT '||---JOIN---';
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-14 16:46:49 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory AS SELECT count(test_01048.mt.a), count(test_01048.mt_2.b), wid FROM test_01048.mt JOIN test_01048.mt_2 ON test_01048.mt.timestamp = test_01048.mt_2.timestamp GROUP BY hop(test_01048.mt.timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
|
2021-12-03 12:52:57 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
2020-03-27 16:44:09 +00:00
|
|
|
|
2022-05-10 07:07:23 +00:00
|
|
|
SELECT '||---POPULATE JOIN---';
|
|
|
|
DROP TABLE IF EXISTS test_01048.wv;
|
2022-05-19 13:04:15 +00:00
|
|
|
CREATE WINDOW VIEW test_01048.wv ENGINE Memory POPULATE AS SELECT count(test_01048.mt.a), count(test_01048.mt_2.b), wid FROM test_01048.mt JOIN test_01048.mt_2 ON test_01048.mt.timestamp = test_01048.mt_2.timestamp GROUP BY hop(test_01048.mt.timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
|
2022-05-10 07:07:23 +00:00
|
|
|
SHOW CREATE TABLE test_01048.`.inner.wv`;
|
|
|
|
|
2021-12-03 12:52:57 +00:00
|
|
|
DROP TABLE test_01048.wv;
|
|
|
|
DROP TABLE test_01048.mt;
|
2022-01-18 09:20:15 +00:00
|
|
|
DROP TABLE test_01048.mt_2;
|