Skip to content

Commit 819d3db

Browse files
Add a test for ClickHouse#36016
1 parent 4cf85b2 commit 819d3db

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

tests/queries/0_stateless/03460_alter_materialized_view_on_cluster.reference

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

0 commit comments

Comments
 (0)