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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
1.4 KiB
MySQL
Raw Normal View History

2022-06-02 11:13:01 +00:00
SET allow_experimental_analyzer = 0;
2022-06-02 11:13:01 +00:00
SET allow_experimental_window_view = 1;
2023-08-15 18:37:39 +00:00
DROP DATABASE IF EXISTS {CLICKHOUSE_DATABASE:Identifier};
2022-06-23 07:59:13 +00:00
set allow_deprecated_database_ordinary=1;
2023-08-15 18:37:39 +00:00
CREATE DATABASE {CLICKHOUSE_DATABASE:Identifier} ENGINE=Ordinary;
2022-06-02 11:13:01 +00:00
2023-08-15 18:37:39 +00:00
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.mt;
DROP TABLE IF EXISTS {CLICKHOUSE_DATABASE:Identifier}.wv;
2022-06-02 11:13:01 +00:00
2023-08-15 18:37:39 +00:00
CREATE TABLE {CLICKHOUSE_DATABASE:Identifier}.mt(a Int32, market Int32, timestamp DateTime) ENGINE=MergeTree ORDER BY tuple();
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv ENGINE Memory WATERMARK=ASCENDING AS SELECT count(a) AS count, market, tumbleEnd(wid) AS w_end FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY tumble(timestamp, INTERVAL '5' SECOND) AS wid, market;
2022-06-02 11:13:01 +00:00
2023-08-15 18:37:39 +00:00
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};
2022-06-02 11:13:01 +00:00
2023-08-15 18:37:39 +00:00
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.wv SYNC;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};
2022-06-02 11:13:01 +00:00
2023-08-15 18:37:39 +00:00
CREATE WINDOW VIEW {CLICKHOUSE_DATABASE:Identifier}.wv ENGINE Memory WATERMARK=ASCENDING AS SELECT count(a) AS count, market, tumbleEnd(wid) AS w_end FROM {CLICKHOUSE_DATABASE:Identifier}.mt GROUP BY tumble(timestamp, INTERVAL '5' SECOND) AS wid, market;
2022-06-02 11:13:01 +00:00
2023-08-15 18:37:39 +00:00
DETACH TABLE {CLICKHOUSE_DATABASE:Identifier}.wv;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};
2022-06-02 11:13:01 +00:00
2023-08-15 18:37:39 +00:00
ATTACH TABLE {CLICKHOUSE_DATABASE:Identifier}.wv;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};
2022-06-02 11:13:01 +00:00
2023-08-15 18:37:39 +00:00
DROP TABLE {CLICKHOUSE_DATABASE:Identifier}.wv SYNC;
SHOW tables FROM {CLICKHOUSE_DATABASE:Identifier};