Added a test

This commit is contained in:
Alexey Milovidov 2020-06-26 02:20:47 +03:00
parent 678d127503
commit c2615d0437
2 changed files with 80 additions and 1 deletions

View File

@ -0,0 +1,42 @@
hello test
1_1_1_0 hello 1
hello test
goodbye test
3_2_2_1 goodbye 3
1_1_1_1 hello 1
1 test
3 test
111 abc
1_1_1_2 1 1
111_3_3_1 111 111
3_2_2_2 3 3
-1111 def
1 test
3 test
111 abc
-1111_5_5_1 -1111 -1111
1_1_1_3_4 1 1
111_3_3_2_4 111 111
3_2_2_3_4 3 3
-11112222 ghi
-1111 def
1 test
3 test
111 abc
-1111_5_5_2_6 -1111 -1111
-11112222_7_7_1 -11112222 -11112222
1_1_1_4_6 1 1
111_3_3_3_6 111 111
3_2_2_4_6 3 3
-1111222233334444 jkl
-11112222 ghi
-1111 def
1 test
3 test
111 abc
-1111_5_5_3_8 -1111 -1111
-11112222_7_7_2_8 -11112222 -11112222
-1111222233334444_9_9_1 -1111222233334444 -1111222233334444
1_1_1_5_8 1 1
111_3_3_4_8 111 111
3_2_2_5_8 3 3

View File

@ -3,10 +3,47 @@ CREATE TABLE test (x Enum('hello' = 1, 'world' = 2), y String) ENGINE = MergeTre
INSERT INTO test VALUES ('hello', 'test');
SELECT * FROM test;
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
ALTER TABLE test MODIFY COLUMN x Enum('hello' = 1, 'world' = 2, 'goodbye' = 3);
INSERT INTO test VALUES ('goodbye', 'test');
OPTIMIZE TABLE test FINAL;
SELECT * FROM test ORDER BY x;
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
ALTER TABLE test MODIFY COLUMN x Int8;
INSERT INTO test VALUES (111, 'abc');
OPTIMIZE TABLE test FINAL;
SELECT * FROM test ORDER BY x;
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
ALTER TABLE test MODIFY COLUMN x Enum8('' = 1); -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x Enum16('' = 1); -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x Int16;
INSERT INTO test VALUES (-1111, 'def');
OPTIMIZE TABLE test FINAL;
SELECT * FROM test ORDER BY x;
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
ALTER TABLE test MODIFY COLUMN x Date; -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x Int32;
INSERT INTO test VALUES (-11112222, 'ghi');
OPTIMIZE TABLE test FINAL;
SELECT * FROM test ORDER BY x;
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
ALTER TABLE test MODIFY COLUMN x DateTime; -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x Int64;
INSERT INTO test VALUES (-1111222233334444, 'jkl');
OPTIMIZE TABLE test FINAL;
SELECT * FROM test ORDER BY x;
SELECT name, partition, partition_id FROM system.parts WHERE database = currentDatabase() AND table = 'test' AND active ORDER BY partition;
ALTER TABLE test MODIFY COLUMN x UInt64; -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x String; -- { serverError 524 }
ALTER TABLE test MODIFY COLUMN x Nullable(Int64); -- { serverError 524 }
DROP TABLE test;