Merge branch 'master' into docs_disk_s3_doesnt_use_copy_object

This commit is contained in:
Alexey Milovidov 2023-10-09 15:20:17 +02:00 committed by GitHub
commit 8cc14af816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 0 deletions

View File

@ -66,6 +66,8 @@ StorageSystemPartsColumns::StorageSystemPartsColumns(const StorageID & table_id_
{"column_modification_time", std::make_shared<DataTypeNullable>(std::make_shared<DataTypeDateTime>())},
{"serialization_kind", std::make_shared<DataTypeString>()},
{"substreams", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>())},
{"filenames", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>())},
{"subcolumns.names", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>())},
{"subcolumns.types", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>())},
{"subcolumns.serializations", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>())},
@ -127,12 +129,14 @@ void StorageSystemPartsColumns::processNextStorage(
{
++column_position;
size_t src_index = 0, res_index = 0;
if (columns_mask[src_index++])
{
WriteBufferFromOwnString out;
part->partition.serializeText(*info.data, out, format_settings);
columns[res_index++]->insert(out.str());
}
if (columns_mask[src_index++])
columns[res_index++]->insert(part->name);
if (columns_mask[src_index++])
@ -250,6 +254,23 @@ void StorageSystemPartsColumns::processNextStorage(
if (columns_mask[src_index++])
columns[res_index++]->insert(ISerialization::kindToString(serialization->getKind()));
Array substreams;
Array filenames;
serialization->enumerateStreams([&](const auto & subpath)
{
auto substream = ISerialization::getFileNameForStream(column.name, subpath);
auto filename = IMergeTreeDataPart::getStreamNameForColumn(column.name, subpath, part->checksums);
substreams.push_back(std::move(substream));
filenames.push_back(filename.value_or(""));
});
if (columns_mask[src_index++])
columns[res_index++]->insert(substreams);
if (columns_mask[src_index++])
columns[res_index++]->insert(filenames);
Array subcolumn_names;
Array subcolumn_types;
Array subcolumn_serializations;

View File

@ -562,6 +562,8 @@ CREATE TABLE system.parts_columns
`column_marks_bytes` UInt64,
`column_modification_time` Nullable(DateTime),
`serialization_kind` String,
`substreams` Array(String),
`filenames` Array(String),
`subcolumns.names` Array(String),
`subcolumns.types` Array(String),
`subcolumns.serializations` Array(String),

View File

@ -0,0 +1,15 @@
0 0 0 [] []
1 0 0 [0] [0]
2 0 0 [0,1] [0,1]
3 0 0 [0,1,2] [0,1,2]
4 0 0 [0,1,2,3] [0,1,2,3]
5 0 0 [] []
6 0 0 [0] [0]
7 0 0 [0,1] [0,1]
8 0 0 [0,1,2] [0,1,2]
9 0 0 [0,1,2,3] [0,1,2,3]
all_1_1_0 arr_col Array(UInt64) Default ['arr_col.size0','arr_col'] ['ab2f1751aeb2f71868a70c40f5a1c4d2','arr_col']
all_1_1_0 id UInt64 Default ['id'] ['id']
all_1_1_0 long_arr_name Array(UInt64) Default ['long_arr_name.size0','long_arr_name'] ['5695f52bca1424d80aff861e1ca37ff0','afca6c20672e26eb0b2b710ee8883442']
all_1_1_0 long_v_name UInt64 Sparse ['long_v_name.sparse.idx','long_v_name'] ['33379dc023a93dfac8b51ef43c3f95b4','ef98b1d8e0e6f28955fd0b0a3ec999e1']
all_1_1_0 v UInt64 Sparse ['v.sparse.idx','v'] ['efd1e477a71fa428621fc25222a78e35','v']

View File

@ -0,0 +1,20 @@
DROP TABLE IF EXISTS t_parts_columns_filenames;
CREATE TABLE t_parts_columns_filenames (id UInt64, v UInt64, long_v_name UInt64, long_arr_name Array(UInt64), arr_col Array(UInt64))
ENGINE = MergeTree ORDER BY id
SETTINGS
min_bytes_for_wide_part = 0,
replace_long_file_name_to_hash = 1,
max_file_name_length = 8,
ratio_of_defaults_for_sparse_serialization = 0.9;
INSERT INTO t_parts_columns_filenames SELECT number, 0, 0, range(number % 5), range(number % 5) FROM numbers(10);
SELECT * FROM t_parts_columns_filenames ORDER BY id;
SELECT name, column, type, serialization_kind, substreams, filenames
FROM system.parts_columns
WHERE database = currentDatabase() AND table = 't_parts_columns_filenames'
ORDER BY name, column;
DROP TABLE IF EXISTS t_parts_columns_filenames;