This commit is contained in:
János Benjamin Antal 2024-08-27 14:31:37 +00:00
parent 793b549291
commit b8d5a82f97
2 changed files with 12 additions and 17 deletions

View File

@ -1,8 +1,4 @@
BEFORE a_r1 x String
BEFORE a_r1 y String MATERIALIZED \'str\'
BEFORE a_r2 x String
BEFORE a_r2 y String MATERIALIZED \'str\'
AFTER a_r1 x String
AFTER a_r1 y String
AFTER a_r2 x String
AFTER a_r2 y String
BEFORE a x String
BEFORE a y String MATERIALIZED \'str\'
AFTER a x String
AFTER a y String

View File

@ -1,14 +1,13 @@
DROP TABLE IF EXISTS a_r1 SYNC;
DROP TABLE IF EXISTS a_r2 SYNC;
CREATE TABLE a_r1 (x String, y String MATERIALIZED 'str') ENGINE = ReplicatedMergeTree('/clickhouse/{database}/a', 'r1') ORDER BY x;
CREATE TABLE a_r2 (x String, y String MATERIALIZED 'str') ENGINE = ReplicatedMergeTree('/clickhouse/{database}/a', 'r2') ORDER BY x;
DROP TABLE IF EXISTS a SYNC;
CREATE TABLE a (x String, y String MATERIALIZED 'str') ENGINE = ReplicatedMergeTree('/clickhouse/{database}/a', 'r1') ORDER BY x;
INSERT INTO a_r1 SELECT toString(number) FROM numbers(100);
SELECT 'BEFORE', table, name, type, default_kind, default_expression FROM system.columns WHERE database = currentDatabase() AND table LIKE 'a\_r%' ORDER BY table, name;
INSERT INTO a SELECT toString(number) FROM numbers(100);
SELECT 'BEFORE', table, name, type, default_kind, default_expression FROM system.columns WHERE database = currentDatabase() AND table = 'a' ORDER BY table, name;
ALTER TABLE a_r1
ADD INDEX IF NOT EXISTS some_index x TYPE set(16) GRANULARITY 1,
-- DROP INDEX is important to make the mutation not a pure metadata mutation
ALTER TABLE a
DROP INDEX IF EXISTS some_index,
MODIFY COLUMN y REMOVE MATERIALIZED
SETTINGS alter_sync = 2, mutations_sync = 2;
SELECT 'AFTER', table, name, type, default_kind, default_expression FROM system.columns WHERE database = currentDatabase() AND table LIKE 'a\_r%' ORDER BY table, name;
SELECT 'AFTER', table, name, type, default_kind, default_expression FROM system.columns WHERE database = currentDatabase() AND table = 'a' ORDER BY table, name;