Add a test

This commit is contained in:
Alexey Milovidov 2024-10-19 00:56:12 +02:00
parent f61f40e01c
commit 6ea6b766bf
3 changed files with 31 additions and 2 deletions

View File

@ -7903,10 +7903,20 @@ try
part_log_elem.table_name = table_id.table_name;
part_log_elem.table_uuid = table_id.uuid;
part_log_elem.partition_id = MergeTreePartInfo::fromPartName(new_part_name, format_version).partition_id;
{
WriteBufferFromString out(part_log_elem.partition);
result_part->partition.serializeText(*this, out, {});
const DataPart * result_or_source_data_part = nullptr;
if (result_part)
result_or_source_data_part = result_part.get();
else if (!source_parts.empty())
result_or_source_data_part = source_parts.at(0).get();
if (result_or_source_data_part)
{
WriteBufferFromString out(part_log_elem.partition);
result_or_source_data_part->partition.serializeText(*this, out, {});
}
}
part_log_elem.part_name = new_part_name;
if (result_part)

View File

@ -0,0 +1,3 @@
1 1 11
1 2 12
0

View File

@ -0,0 +1,16 @@
DROP TABLE IF EXISTS test;
CREATE TABLE test (x UInt8, y UInt8, z String DEFAULT toString(x)) PARTITION BY x ORDER BY x;
INSERT INTO test (x, y) VALUES (1, 1);
INSERT INTO test (x, y) VALUES (1, 2);
OPTIMIZE TABLE test FINAL;
INSERT INTO test (x, y) VALUES (2, 1);
ALTER TABLE test DROP PARTITION 2;
SET mutations_sync = 1;
ALTER TABLE test UPDATE z = x || y WHERE 1;
SELECT * FROM test ORDER BY ALL;
TRUNCATE TABLE test;
DROP TABLE test SYNC;
SYSTEM FLUSH LOGS;
-- SELECT * FROM system.part_log WHERE database = currentDatabase() FORMAT Vertical;
SELECT DISTINCT throwIf(empty(partition)) FROM system.part_log WHERE database = currentDatabase();