fix update of empty Nested columns

This commit is contained in:
Anton Popov 2023-02-14 02:28:37 +00:00
parent 2190a2a6c4
commit 1ab37ad5ed
3 changed files with 32 additions and 1 deletions

View File

@ -497,7 +497,15 @@ static NameSet collectFilesToSkip(
auto source_updated_stream_counts = getStreamCounts(source_part, updated_header.getNames());
auto new_updated_stream_counts = getStreamCounts(new_part, updated_header.getNames());
/// Skip updated files
/// Skip all modified files in new part.
for (const auto & [stream_name, _] : new_updated_stream_counts)
{
files_to_skip.insert(stream_name + ".bin");
files_to_skip.insert(stream_name + mrk_extension);
}
/// Skip files that we read from source part and do not write in new part.
/// E.g. ALTER MODIFY from LowCardinality(String) to String.
for (const auto & [stream_name, _] : source_updated_stream_counts)
{
/// If we read shared stream and do not write it

View File

@ -0,0 +1 @@
450000 450000

View File

@ -0,0 +1,22 @@
DROP TABLE IF EXISTS t_update_empty_nested;
CREATE TABLE t_update_empty_nested
(
`id` UInt32,
`nested.arr1` Array(UInt64),
)
ENGINE = MergeTree
ORDER BY id
SETTINGS min_bytes_for_wide_part = 0;
SET mutations_sync = 2;
INSERT INTO t_update_empty_nested SELECT 1, range(number % 10) FROM numbers(100000);
ALTER TABLE t_update_empty_nested ADD COLUMN `nested.arr2` Array(UInt64);
ALTER TABLE t_update_empty_nested UPDATE `nested.arr2` = `nested.arr1` WHERE 1;
SELECT * FROM t_update_empty_nested FORMAT Null;
SELECT sum(length(nested.arr1)), sum(length(nested.arr2)) FROM t_update_empty_nested;
DROP TABLE t_update_empty_nested;