mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-06 14:32:22 +00:00
151ba92a2e
Consider the following example: CREATE TABLE data (root.array_str Array(UInt8)) ENGINE = MergeTree() ORDER BY tuple(); INSERT INTO data VALUES ([]); ALTER TABLE data ADD COLUMN root.nested_array Array(Array(UInt8)); In this case the first part will not have data for root.nested_array, and thanks to #37152 it will simply read offsets column from root.array_str, however since root.nested_array is a nested array, it will try to read elements from the same offsets stream and if you are lucky enough you will get one of the following errors: - Cannot read all data. Bytes read: 1. Bytes expected: 8.: (while reading column root.nested_array): While executing MergeTreeInOrder. (CANNOT_READ_ALL_DATA) - DB::Exception: Array size is too large: 8233460228287709730: (while reading column serp.serp_features): While executing MergeTreeInOrder. So to address this, findColumnForOffsets() had been changed to return the level of the column too, to allow to read only up to this level. Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
46 lines
1.7 KiB
SQL
46 lines
1.7 KiB
SQL
DROP TABLE IF EXISTS data_compact;
|
|
DROP TABLE IF EXISTS data_memory;
|
|
DROP TABLE IF EXISTS data_wide;
|
|
|
|
-- compact
|
|
DROP TABLE IF EXISTS data_compact;
|
|
CREATE TABLE data_compact
|
|
(
|
|
`root.array` Array(UInt8),
|
|
)
|
|
ENGINE = MergeTree()
|
|
ORDER BY tuple()
|
|
SETTINGS min_rows_for_compact_part=0, min_bytes_for_compact_part=0, min_rows_for_wide_part=100, min_bytes_for_wide_part=1e9;
|
|
INSERT INTO data_compact VALUES ([0]);
|
|
ALTER TABLE data_compact ADD COLUMN root.nested_array Array(Array(UInt8));
|
|
SELECT table, part_type FROM system.parts WHERE table = 'data_compact' AND database = currentDatabase();
|
|
SELECT root.nested_array FROM data_compact;
|
|
|
|
-- memory
|
|
DROP TABLE IF EXISTS data_memory;
|
|
CREATE TABLE data_memory
|
|
(
|
|
`root.array` Array(UInt8),
|
|
)
|
|
ENGINE = MergeTree()
|
|
ORDER BY tuple()
|
|
SETTINGS min_rows_for_compact_part=100, min_bytes_for_compact_part=1e9, min_rows_for_wide_part=100, min_bytes_for_wide_part=1e9, in_memory_parts_enable_wal=0;
|
|
INSERT INTO data_memory VALUES ([0]);
|
|
ALTER TABLE data_memory ADD COLUMN root.nested_array Array(Array(UInt8));
|
|
SELECT table, part_type FROM system.parts WHERE table = 'data_memory' AND database = currentDatabase();
|
|
SELECT root.nested_array FROM data_memory;
|
|
|
|
-- wide
|
|
DROP TABLE IF EXISTS data_wide;
|
|
CREATE TABLE data_wide
|
|
(
|
|
`root.array` Array(UInt8),
|
|
)
|
|
ENGINE = MergeTree()
|
|
ORDER BY tuple()
|
|
SETTINGS min_rows_for_wide_part=0, min_bytes_for_wide_part=0, min_rows_for_wide_part=0, min_bytes_for_wide_part=0;
|
|
INSERT INTO data_wide VALUES ([0]);
|
|
ALTER TABLE data_wide ADD COLUMN root.nested_array Array(Array(UInt8));
|
|
SELECT table, part_type FROM system.parts WHERE table = 'data_wide' AND database = currentDatabase();
|
|
SELECT root.nested_array FROM data_wide;
|