mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
parent
5d5ed63e8c
commit
b68b60fb38
@ -444,6 +444,7 @@ void StorageMergeTree::clearColumnInPartition(const ASTPtr & partition, const Fi
|
||||
for (auto & transaction : transactions)
|
||||
transaction->commit();
|
||||
|
||||
/// Recalculate columns size (not only for the modified column)
|
||||
data.recalculateColumnSizes();
|
||||
}
|
||||
|
||||
|
@ -1467,6 +1467,7 @@ void StorageReplicatedMergeTree::executeClearColumnInPartition(const LogEntry &
|
||||
|
||||
LOG_DEBUG(log, "Cleared column " << entry.column_name << " in " << modified_parts << " parts");
|
||||
|
||||
/// Recalculate columns size (not only for the modified column)
|
||||
data.recalculateColumnSizes();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,12 @@
|
||||
===Ordinary case===
|
||||
16
|
||||
1 a
|
||||
2 b
|
||||
0 a
|
||||
2 b
|
||||
8
|
||||
0 0
|
||||
===Replicated case===
|
||||
all
|
||||
2000-01-01 0
|
||||
2000-01-01 1 a
|
||||
|
@ -1,15 +1,23 @@
|
||||
SELECT '===Ordinary case===';
|
||||
|
||||
DROP TABLE IF EXISTS test.clear_column;
|
||||
CREATE TABLE test.clear_column (d Date, num Int64, str String) ENGINE = MergeTree(d, d, 8192);
|
||||
|
||||
INSERT INTO test.clear_column VALUES ('2016-12-12', 1, 'a'), ('2016-11-12', 2, 'b');
|
||||
|
||||
SELECT data_uncompressed_bytes FROM system.columns WHERE (database = 'test') AND (table = 'clear_column') AND (name = 'num');
|
||||
|
||||
SELECT num, str FROM test.clear_column ORDER BY num;
|
||||
ALTER TABLE test.clear_column CLEAR COLUMN num IN PARTITION '201612';
|
||||
SELECT num, str FROM test.clear_column ORDER BY num;
|
||||
|
||||
SELECT data_uncompressed_bytes FROM system.columns WHERE (database = 'test') AND (table = 'clear_column') AND (name = 'num');
|
||||
ALTER TABLE test.clear_column CLEAR COLUMN num IN PARTITION '201611';
|
||||
SELECT data_compressed_bytes, data_uncompressed_bytes FROM system.columns WHERE (database = 'test') AND (table = 'clear_column') AND (name = 'num');
|
||||
|
||||
DROP TABLE test.clear_column;
|
||||
|
||||
-- Replicated case
|
||||
SELECT '===Replicated case===';
|
||||
|
||||
DROP TABLE IF EXISTS test.clear_column1;
|
||||
DROP TABLE IF EXISTS test.clear_column2;
|
||||
|
Loading…
Reference in New Issue
Block a user