Skip to content

Commit ce890ea

Browse files
Merge pull request ClickHouse#80234 from ClickHouse/add-test-36016
Add a test for ClickHouse#36016
2 parents bb83c84 + 3cf891a commit ce890ea

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

tests/queries/0_stateless/03460_alter_materialized_view_on_cluster.reference

Whitespace-only changes.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
-- Tags: no-replicated-database
2+
-- ^ due to the usage of ON CLUSTER queries
3+
4+
SET distributed_ddl_output_mode = 'none', enable_analyzer = true;
5+
6+
drop table if exists source, mview;
7+
8+
CREATE TABLE source
9+
(
10+
timestamp DateTime,
11+
card_id UInt64,
12+
_id String
13+
)
14+
ENGINE = MergeTree Partition by toYYYYMM(timestamp)
15+
ORDER BY _id TTL toDateTime(timestamp + toIntervalDay(7));
16+
17+
CREATE MATERIALIZED VIEW mview on cluster test_shard_localhost
18+
ENGINE = SummingMergeTree ORDER BY (day, card_id)
19+
as SELECT
20+
toDate(timestamp) AS day,
21+
card_id,
22+
count(*) AS card_view
23+
FROM source GROUP BY (day, card_id);
24+
25+
DROP TABLE mview;
26+
27+
CREATE MATERIALIZED VIEW mview on cluster test_shard_localhost
28+
(
29+
day Date,
30+
card_id UInt64,
31+
card_view Int64
32+
)
33+
ENGINE = SummingMergeTree ORDER BY (day, card_id)
34+
as SELECT
35+
toDate(timestamp) AS day,
36+
card_id,
37+
count(*) AS card_view
38+
FROM source GROUP BY (day, card_id);
39+
40+
alter table source on cluster test_shard_localhost MODIFY SETTING ttl_only_drop_parts = 1;
41+
42+
drop table if exists mview, source;

0 commit comments

Comments
 (0)