2021-08-12 07:38:36 +00:00
|
|
|
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;
|
|
|
|
|
2024-05-30 12:27:25 +00:00
|
|
|
ALTER TABLE tmp MATERIALIZE COLUMN x; -- { serverError BAD_ARGUMENTS }
|
2021-12-09 15:58:28 +00:00
|
|
|
|
2021-08-12 07:38:36 +00:00
|
|
|
ALTER TABLE tmp ADD COLUMN s String DEFAULT toString(x);
|
2023-02-17 16:50:20 +00:00
|
|
|
SELECT arraySort(arraySort(groupArray(x))), groupArray(s) FROM tmp;
|
2021-08-12 07:38:36 +00:00
|
|
|
|
|
|
|
ALTER TABLE tmp MODIFY COLUMN s String DEFAULT toString(x+1);
|
2023-02-17 16:50:20 +00:00
|
|
|
SELECT arraySort(groupArray(x)), groupArray(s) FROM tmp;
|
2021-08-12 07:38:36 +00:00
|
|
|
|
|
|
|
ALTER TABLE tmp MATERIALIZE COLUMN s;
|
|
|
|
ALTER TABLE tmp MODIFY COLUMN s String DEFAULT toString(x+2);
|
2023-02-17 16:50:20 +00:00
|
|
|
SELECT arraySort(groupArray(x)), groupArray(s) FROM tmp;
|
2021-08-12 07:38:36 +00:00
|
|
|
|
2023-12-19 09:53:04 +00:00
|
|
|
ALTER TABLE tmp CLEAR COLUMN s; -- Need to clear because MATERIALIZE COLUMN won't override past values;
|
2021-08-12 07:38:36 +00:00
|
|
|
ALTER TABLE tmp MATERIALIZE COLUMN s;
|
|
|
|
ALTER TABLE tmp MODIFY COLUMN s String DEFAULT toString(x+3);
|
2023-02-17 16:50:20 +00:00
|
|
|
SELECT arraySort(groupArray(x)), groupArray(s) FROM tmp;
|
2021-08-12 07:38:36 +00:00
|
|
|
ALTER TABLE tmp DROP COLUMN s;
|
|
|
|
|
|
|
|
ALTER TABLE tmp ADD COLUMN s String MATERIALIZED toString(x);
|
2023-02-17 16:50:20 +00:00
|
|
|
SELECT arraySort(groupArray(x)), groupArray(s) FROM tmp;
|
2021-08-12 07:38:36 +00:00
|
|
|
|
|
|
|
ALTER TABLE tmp MODIFY COLUMN s String MATERIALIZED toString(x+1);
|
2023-02-17 16:50:20 +00:00
|
|
|
SELECT arraySort(groupArray(x)), groupArray(s) FROM tmp;
|
2021-08-12 07:38:36 +00:00
|
|
|
|
|
|
|
ALTER TABLE tmp MATERIALIZE COLUMN s;
|
|
|
|
ALTER TABLE tmp MODIFY COLUMN s String MATERIALIZED toString(x+2);
|
2023-02-17 16:50:20 +00:00
|
|
|
SELECT arraySort(groupArray(x)), groupArray(s) FROM tmp;
|
2021-08-12 07:38:36 +00:00
|
|
|
|
|
|
|
ALTER TABLE tmp MATERIALIZE COLUMN s;
|
|
|
|
ALTER TABLE tmp MODIFY COLUMN s String MATERIALIZED toString(x+3);
|
2023-02-17 16:50:20 +00:00
|
|
|
SELECT arraySort(groupArray(x)), groupArray(s) FROM tmp;
|
2021-08-12 07:38:36 +00:00
|
|
|
ALTER TABLE tmp DROP COLUMN s;
|
|
|
|
|
|
|
|
DROP TABLE tmp;
|
|
|
|
|