2022-06-02 11:13:01 +00:00
|
|
|
|
2024-02-21 22:26:30 +00:00
|
|
|
SET send_logs_level = 'fatal';
|
2023-03-07 11:30:54 +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;
|
2024-02-21 17:55:30 +00:00
|
|
|
-- Creation of a database with Ordinary engine emits a warning.
|
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};
|