update tests

This commit is contained in:
Vxider 2020-07-15 12:52:51 +08:00
parent 3e77a5a982
commit 6191f883a5
21 changed files with 55 additions and 0 deletions

View File

@ -7,26 +7,31 @@ CREATE TABLE mt(a Int32, b Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY
SELECT '---TUMBLE---';
SELECT '||---WINDOW COLUMN NAME---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY TUMBLE(timestamp, INTERVAL '1' SECOND) AS SELECT count(a), TUMBLE_END(wid) AS count FROM mt GROUP BY TUMBLE(timestamp, INTERVAL '1' SECOND) as wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---WINDOW COLUMN ALIAS---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY wid AS SELECT count(a) AS count, TUMBLE(timestamp, INTERVAL '1' SECOND) AS wid FROM mt GROUP BY wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---IDENTIFIER---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY (TUMBLE(timestamp, INTERVAL '1' SECOND), b) PRIMARY KEY TUMBLE(timestamp, INTERVAL '1' SECOND) AS SELECT count(a) AS count FROM mt GROUP BY b, TUMBLE(timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---FUNCTION---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY (TUMBLE(timestamp, INTERVAL '1' SECOND), plus(a, b)) PRIMARY KEY TUMBLE(timestamp, INTERVAL '1' SECOND) AS SELECT count(a) AS count FROM mt GROUP BY plus(a, b) as _type, TUMBLE(timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---PARTITION---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY wid PARTITION BY wid AS SELECT count(a) AS count, TUMBLE(now(), INTERVAL '1' SECOND) AS wid FROM mt GROUP BY wid;
SHOW CREATE TABLE `.inner.wv`;
@ -34,26 +39,31 @@ SHOW CREATE TABLE `.inner.wv`;
SELECT '---HOP---';
SELECT '||---WINDOW COLUMN NAME---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS SELECT count(a) AS count, HOP_END(wid) FROM mt GROUP BY HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) as wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---WINDOW COLUMN ALIAS---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY wid AS SELECT count(a) AS count, HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid FROM mt GROUP BY wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---IDENTIFIER---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY (HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND), b) PRIMARY KEY HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS SELECT count(a) AS count FROM mt GROUP BY b, HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---FUNCTION---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY (HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND), plus(a, b)) PRIMARY KEY HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS SELECT count(a) AS count FROM mt GROUP BY plus(a, b) as _type, HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---PARTITION---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv ENGINE AggregatingMergeTree ORDER BY wid PARTITION BY wid AS SELECT count(a) AS count, HOP_END(wid) FROM mt GROUP BY HOP(now(), INTERVAL '1' SECOND, INTERVAL '3' SECOND) as wid;
SHOW CREATE TABLE `.inner.wv`;

View File

@ -8,29 +8,35 @@ CREATE TABLE mt(a Int32, b Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY
SELECT '---TUMBLE---';
SELECT '||---WINDOW COLUMN NAME---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count, TUMBLE_END(wid) as wend FROM mt GROUP BY TUMBLE(timestamp, INTERVAL '1' SECOND) as wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---WINDOW COLUMN ALIAS---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count, TUMBLE(timestamp, INTERVAL '1' SECOND) AS wid FROM mt GROUP BY wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---IDENTIFIER---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count FROM mt GROUP BY b, TUMBLE(timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE `.inner.wv`;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count FROM mt GROUP BY TUMBLE(timestamp, INTERVAL '1' SECOND) AS wid, b;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---FUNCTION---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count FROM mt GROUP BY plus(a, b) as _type, TUMBLE(timestamp, INTERVAL '1' SECOND) AS wid;
SHOW CREATE TABLE `.inner.wv`;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count FROM mt GROUP BY TUMBLE(timestamp, INTERVAL '1' SECOND) AS wid, plus(a, b);
SHOW CREATE TABLE `.inner.wv`;
@ -38,29 +44,35 @@ SHOW CREATE TABLE `.inner.wv`;
SELECT '---HOP---';
SELECT '||---WINDOW COLUMN NAME---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count, HOP_END(wid) as wend FROM mt GROUP BY HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) as wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---WINDOW COLUMN ALIAS---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count, HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid FROM mt GROUP BY wid;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---IDENTIFIER---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count FROM mt GROUP BY b, HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE `.inner.wv`;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count FROM mt GROUP BY HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid, b;
SHOW CREATE TABLE `.inner.wv`;
SELECT '||---FUNCTION---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count FROM mt GROUP BY plus(a, b) as _type, HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid;
SHOW CREATE TABLE `.inner.wv`;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a) AS count FROM mt GROUP BY HOP(timestamp, INTERVAL '1' SECOND, INTERVAL '3' SECOND) AS wid, plus(a, b);
SHOW CREATE TABLE `.inner.wv`;

View File

@ -6,26 +6,32 @@ CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
SELECT '---WATERMARK---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv WATERMARK=INTERVAL '1' SECOND AS SELECT count(a), TUMBLE_START(wid) AS w_start, TUMBLE_END(wid) AS w_end FROM mt GROUP BY TUMBLE(timestamp, INTERVAL '3' SECOND) AS wid;
SELECT '---With w_end---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a), TUMBLE_START(wid) AS w_start, TUMBLE_END(wid) AS w_end FROM mt GROUP BY TUMBLE(timestamp, INTERVAL '3' SECOND) AS wid;
SELECT '---WithOut w_end---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a), TUMBLE_START(wid) AS w_start FROM mt GROUP BY TUMBLE(timestamp, INTERVAL '3' SECOND) AS wid;
SELECT '---WITH---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS WITH toDateTime('2018-01-01 00:00:00') AS date_time SELECT count(a), TUMBLE_START(wid) AS w_start, TUMBLE_END(wid) AS w_end, date_time FROM mt GROUP BY TUMBLE(timestamp, INTERVAL '3' SECOND) AS wid;
SELECT '---WHERE---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a), TUMBLE_START(wid) AS w_start FROM mt WHERE a != 1 GROUP BY TUMBLE(timestamp, INTERVAL '3' SECOND) AS wid;
SELECT '---ORDER_BY---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a), TUMBLE_START(wid) AS w_start FROM mt WHERE a != 1 GROUP BY TUMBLE(timestamp, INTERVAL '3' SECOND) AS wid ORDER BY w_start;
DROP TABLE mt;

View File

@ -6,26 +6,32 @@ CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
SELECT '---WATERMARK---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv WATERMARK=INTERVAL '1' SECOND AS SELECT count(a), HOP_START(wid) AS w_start, HOP_END(wid) AS w_end FROM mt GROUP BY HOP(timestamp, INTERVAL '3' SECOND, INTERVAL '5' SECOND) AS wid;
SELECT '---With w_end---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a), HOP_START(wid) AS w_start, HOP_END(wid) AS w_end FROM mt GROUP BY HOP(timestamp, INTERVAL '3' SECOND, INTERVAL '5' SECOND) AS wid;
SELECT '---WithOut w_end---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a), HOP_START(wid) AS w_start FROM mt GROUP BY HOP(timestamp, INTERVAL '3' SECOND, INTERVAL '5' SECOND) AS wid;
SELECT '---WITH---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS WITH toDateTime('2018-01-01 00:00:00') AS date_time SELECT count(a), HOP_START(wid) AS w_start, HOP_END(wid) AS w_end, date_time FROM mt GROUP BY HOP(timestamp, INTERVAL '3' SECOND, INTERVAL '5' SECOND) AS wid;
SELECT '---WHERE---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a), HOP_START(wid) AS w_start FROM mt WHERE a != 1 GROUP BY HOP(timestamp, INTERVAL '3' SECOND, INTERVAL '5' SECOND) AS wid;
SELECT '---ORDER_BY---';
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE WINDOW VIEW wv AS SELECT count(a), HOP_START(wid) AS w_start FROM mt WHERE a != 1 GROUP BY HOP(timestamp, INTERVAL '3' SECOND, INTERVAL '5' SECOND) AS wid ORDER BY w_start;
DROP TABLE mt;

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32) ENGINE=MergeTree ORDER BY tuple();

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32) ENGINE=MergeTree ORDER BY tuple();

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -27,6 +27,8 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client1.expect(prompt)
client1.send('DROP TABLE IF EXISTS test.wv')
client1.expect(prompt)
client1.send('DROP TABLE IF EXISTS `.inner.wv`')
client1.expect(prompt)
client1.send('CREATE TABLE test.mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple()')
client1.expect(prompt)

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -27,6 +27,8 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client1.expect(prompt)
client1.send('DROP TABLE IF EXISTS test.wv')
client1.expect(prompt)
client1.send('DROP TABLE IF EXISTS `.inner.wv`')
client1.expect(prompt)
client1.send('CREATE TABLE test.mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple()')
client1.expect(prompt)

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -27,6 +27,8 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client1.expect(prompt)
client1.send('DROP TABLE IF EXISTS test.wv')
client1.expect(prompt)
client1.send('DROP TABLE IF EXISTS `.inner.wv`')
client1.expect(prompt)
client1.send('CREATE TABLE test.mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple()')
client1.expect(prompt)

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -27,6 +27,8 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client1.expect(prompt)
client1.send('DROP TABLE IF EXISTS test.wv')
client1.expect(prompt)
client1.send('DROP TABLE IF EXISTS `.inner.wv`')
client1.expect(prompt)
client1.send('CREATE TABLE test.mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple()')
client1.expect(prompt)

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();

View File

@ -3,6 +3,7 @@ SET allow_experimental_window_view = 1;
DROP TABLE IF EXISTS mt;
DROP TABLE IF EXISTS dst;
DROP TABLE IF EXISTS wv;
DROP TABLE IF EXISTS `.inner.wv`;
CREATE TABLE dst(count UInt64, w_end DateTime) Engine=MergeTree ORDER BY tuple();
CREATE TABLE mt(a Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();