mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
40 lines
1.3 KiB
MySQL
40 lines
1.3 KiB
MySQL
|
DROP TABLE IF EXISTS tmp;
|
||
|
|
||
|
SET mutations_sync = 2;
|
||
|
|
||
|
CREATE TABLE tmp (x Int64) ENGINE = MergeTree() ORDER BY tuple() PARTITION BY tuple();
|
||
|
INSERT INTO tmp SELECT * FROM system.numbers LIMIT 20;
|
||
|
|
||
|
ALTER TABLE tmp ADD COLUMN s String DEFAULT toString(x);
|
||
|
SELECT groupArray(x), groupArray(s) FROM tmp;
|
||
|
|
||
|
ALTER TABLE tmp MODIFY COLUMN s String DEFAULT toString(x+1);
|
||
|
SELECT groupArray(x), groupArray(s) FROM tmp;
|
||
|
|
||
|
ALTER TABLE tmp MATERIALIZE COLUMN s;
|
||
|
ALTER TABLE tmp MODIFY COLUMN s String DEFAULT toString(x+2);
|
||
|
SELECT groupArray(x), groupArray(s) FROM tmp;
|
||
|
|
||
|
ALTER TABLE tmp MATERIALIZE COLUMN s;
|
||
|
ALTER TABLE tmp MODIFY COLUMN s String DEFAULT toString(x+3);
|
||
|
SELECT groupArray(x), groupArray(s) FROM tmp;
|
||
|
ALTER TABLE tmp DROP COLUMN s;
|
||
|
|
||
|
ALTER TABLE tmp ADD COLUMN s String MATERIALIZED toString(x);
|
||
|
SELECT groupArray(x), groupArray(s) FROM tmp;
|
||
|
|
||
|
ALTER TABLE tmp MODIFY COLUMN s String MATERIALIZED toString(x+1);
|
||
|
SELECT groupArray(x), groupArray(s) FROM tmp;
|
||
|
|
||
|
ALTER TABLE tmp MATERIALIZE COLUMN s;
|
||
|
ALTER TABLE tmp MODIFY COLUMN s String MATERIALIZED toString(x+2);
|
||
|
SELECT groupArray(x), groupArray(s) FROM tmp;
|
||
|
|
||
|
ALTER TABLE tmp MATERIALIZE COLUMN s;
|
||
|
ALTER TABLE tmp MODIFY COLUMN s String MATERIALIZED toString(x+3);
|
||
|
SELECT groupArray(x), groupArray(s) FROM tmp;
|
||
|
ALTER TABLE tmp DROP COLUMN s;
|
||
|
|
||
|
DROP TABLE tmp;
|
||
|
|