2023-01-03 19:22:31 +00:00
|
|
|
-- Tags: no-upgrade-check
|
2022-02-18 10:14:10 +00:00
|
|
|
|
2021-11-03 20:29:48 +00:00
|
|
|
SET mutations_sync = 2;
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS t_sparse_alter;
|
|
|
|
|
|
|
|
CREATE TABLE t_sparse_alter (id UInt64, u UInt64, s String)
|
|
|
|
ENGINE = MergeTree ORDER BY id
|
|
|
|
SETTINGS ratio_of_defaults_for_sparse_serialization = 0.5;
|
|
|
|
INSERT INTO t_sparse_alter SELECT
|
|
|
|
number,
|
2021-12-01 18:21:38 +00:00
|
|
|
if (number % 11 = 0, number, 0),
|
|
|
|
if (number % 13 = 0, toString(number), '')
|
|
|
|
FROM numbers(2000);
|
2021-11-03 20:29:48 +00:00
|
|
|
|
2022-01-31 22:25:35 +00:00
|
|
|
SELECT column, serialization_kind FROM system.parts_columns WHERE database = currentDatabase() AND table = 't_sparse_alter' AND active ORDER BY column;
|
2021-11-03 20:29:48 +00:00
|
|
|
|
|
|
|
SELECT uniqExact(u), uniqExact(s) FROM t_sparse_alter;
|
|
|
|
|
|
|
|
ALTER TABLE t_sparse_alter DROP COLUMN s, RENAME COLUMN u TO t;
|
|
|
|
ALTER TABLE t_sparse_alter MODIFY COLUMN t UInt16;
|
|
|
|
|
2022-01-31 22:25:35 +00:00
|
|
|
SELECT column, serialization_kind FROM system.parts_columns WHERE database = currentDatabase() AND table = 't_sparse_alter' AND active ORDER BY column;
|
2021-11-03 20:29:48 +00:00
|
|
|
|
|
|
|
SELECT uniqExact(t) FROM t_sparse_alter;
|
|
|
|
|
2022-03-15 01:48:21 +00:00
|
|
|
DETACH TABLE t_sparse_alter;
|
|
|
|
ATTACH TABLE t_sparse_alter;
|
|
|
|
|
|
|
|
SELECT column, serialization_kind FROM system.parts_columns WHERE database = currentDatabase() AND table = 't_sparse_alter' AND active ORDER BY column;
|
|
|
|
SELECT uniqExact(t) FROM t_sparse_alter;
|
|
|
|
|
2021-11-03 20:29:48 +00:00
|
|
|
DROP TABLE t_sparse_alter;
|