mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
commit
eccee280a2
@ -755,9 +755,9 @@ bool isMetadataOnlyConversion(const IDataType * from, const IDataType * to)
|
||||
|
||||
const auto * nullable_from = typeid_cast<const DataTypeNullable *>(from);
|
||||
const auto * nullable_to = typeid_cast<const DataTypeNullable *>(to);
|
||||
if (nullable_to)
|
||||
if (nullable_from && nullable_to)
|
||||
{
|
||||
from = nullable_from ? nullable_from->getNestedType().get() : from;
|
||||
from = nullable_from->getNestedType().get();
|
||||
to = nullable_to->getNestedType().get();
|
||||
continue;
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
2
|
@ -0,0 +1,16 @@
|
||||
DROP TABLE IF EXISTS t1 SYNC;
|
||||
CREATE TABLE t1 (v UInt64) ENGINE=ReplicatedMergeTree('/test/tables/{database}/test/t1', 'r1') ORDER BY v PARTITION BY v;
|
||||
INSERT INTO t1 values(1);
|
||||
ALTER TABLE t1 ADD COLUMN s String;
|
||||
INSERT INTO t1 values(1, '1');
|
||||
ALTER TABLE t1 MODIFY COLUMN s Nullable(String);
|
||||
-- SELECT _part, * FROM t1;
|
||||
|
||||
alter table t1 detach partition 1;
|
||||
|
||||
SELECT _part, * FROM t1;
|
||||
--0 rows in set. Elapsed: 0.001 sec.
|
||||
|
||||
alter table t1 attach partition 1;
|
||||
select count() from t1;
|
||||
|
@ -0,0 +1 @@
|
||||
1,"one",1,0
|
@ -0,0 +1,26 @@
|
||||
DROP TABLE IF EXISTS column_modify_test;
|
||||
|
||||
CREATE TABLE column_modify_test (id UInt64, val String, other_col UInt64) engine=MergeTree ORDER BY id SETTINGS min_bytes_for_wide_part=0;
|
||||
INSERT INTO column_modify_test VALUES (1,'one',0);
|
||||
INSERT INTO column_modify_test VALUES (2,'two',0);
|
||||
|
||||
-- on 21.9 that was done via mutations mechanism
|
||||
ALTER TABLE column_modify_test MODIFY COLUMN val Nullable(String);
|
||||
|
||||
-- but since 21.10 it only applies that to new part, so old parts keep the old schema
|
||||
--SELECT * FROM system.mutations;
|
||||
|
||||
INSERT INTO column_modify_test VALUES (3,Null,0);
|
||||
|
||||
--select name, path, type, active, modification_time from system.parts_columns where table='column_modify_test' and column='val';
|
||||
|
||||
-- till now everythings looks ok
|
||||
--SELECT * FROM column_modify_test;
|
||||
|
||||
-- now we do mutation. It will affect one of the parts
|
||||
-- and it what part it will update columns.txt to the latest 'correct' state w/o updating the column file!
|
||||
alter table column_modify_test update other_col=1 where id = 1 SETTINGS mutations_sync=1;
|
||||
|
||||
-- row 1 is damaged now: the column files of val columns & columns.txt is out of sync!
|
||||
SELECT *, throwIf(val <> 'one') FROM column_modify_test WHERE id = 1 FORMAT CSV;
|
||||
|
Loading…
Reference in New Issue
Block a user