mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
fix update of empty Nested columns
This commit is contained in:
parent
2190a2a6c4
commit
1ab37ad5ed
@ -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
|
||||
|
@ -0,0 +1 @@
|
||||
450000 450000
|
22
tests/queries/0_stateless/02565_update_empty_nested.sql
Normal file
22
tests/queries/0_stateless/02565_update_empty_nested.sql
Normal 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;
|
Loading…
Reference in New Issue
Block a user