ClickHouse/tests/queries/0_stateless/01085_window_view_attach.sql

30 lines
1.0 KiB
MySQL
Raw Normal View History

2022-06-02 11:13:01 +00:00
-- Tags: no-parallel
SET allow_experimental_window_view = 1;
DROP DATABASE IF EXISTS test_01085;
2022-06-23 07:59:13 +00:00
set allow_deprecated_database_ordinary=1;
2022-06-02 11:13:01 +00:00
CREATE DATABASE test_01085 ENGINE=Ordinary;
DROP TABLE IF EXISTS test_01085.mt;
DROP TABLE IF EXISTS test_01085.wv;
CREATE TABLE test_01085.mt(a Int32, market Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
CREATE WINDOW VIEW test_01085.wv ENGINE Memory WATERMARK=ASCENDING AS SELECT count(a) AS count, market, tumbleEnd(wid) AS w_end FROM test_01085.mt GROUP BY tumble(timestamp, INTERVAL '5' SECOND) AS wid, market;
SHOW tables FROM test_01085;
DROP TABLE test_01085.wv NO DELAY;
SHOW tables FROM test_01085;
CREATE WINDOW VIEW test_01085.wv ENGINE Memory WATERMARK=ASCENDING AS SELECT count(a) AS count, market, tumbleEnd(wid) AS w_end FROM test_01085.mt GROUP BY tumble(timestamp, INTERVAL '5' SECOND) AS wid, market;
DETACH TABLE test_01085.wv;
SHOW tables FROM test_01085;
ATTACH TABLE test_01085.wv;
SHOW tables FROM test_01085;
DROP TABLE test_01085.wv NO DELAY;
SHOW tables FROM test_01085;