try to fix Nested

This commit is contained in:
Anton Popov 2022-07-22 23:05:11 +00:00
parent 49627aa554
commit 3d03b2714b
3 changed files with 10 additions and 9 deletions

View File

@ -448,7 +448,12 @@ void IMergeTreeDataPart::setColumns(const NamesAndTypesList & new_columns)
for (const auto & column : columns)
column_name_to_position.emplace(column.name, pos++);
columns_description = ColumnsDescription(columns);
/// For wide parts convert plain arrays to Nested for
/// more convinient managing of shared offsets column.
if (part_type == Type::Wide)
columns_description = ColumnsDescription(Nested::collect(columns));
else
columns_description = ColumnsDescription(columns);
}
NameAndTypePair IMergeTreeDataPart::getColumn(const String & column_name) const

View File

@ -42,12 +42,6 @@ IMergeTreeReader::IMergeTreeReader(
, all_mark_ranges(all_mark_ranges_)
, alter_conversions(storage.getAlterConversionsForPart(data_part))
{
if (isWidePart(data_part))
{
/// For wide parts convert plain arrays of Nested to subcolumns
/// to allow to use shared offset column from cache.
columns = Nested::convertToSubcolumns(columns);
}
}
IMergeTreeReader::~IMergeTreeReader() = default;

View File

@ -49,7 +49,8 @@ IMergeTreeDataPart::MergeTreeReaderPtr MergeTreeDataPartWide::getReader(
{
auto ptr = std::static_pointer_cast<const MergeTreeDataPartWide>(shared_from_this());
return std::make_unique<MergeTreeReaderWide>(
ptr, columns_to_read, metadata_snapshot, uncompressed_cache,
ptr, Nested::convertToSubcolumns(columns_to_read),
metadata_snapshot, uncompressed_cache,
mark_cache, mark_ranges, reader_settings,
avg_value_size_hints, profile_callback);
}
@ -64,7 +65,8 @@ IMergeTreeDataPart::MergeTreeWriterPtr MergeTreeDataPartWide::getWriter(
const MergeTreeIndexGranularity & computed_index_granularity) const
{
return std::make_unique<MergeTreeDataPartWriterWide>(
shared_from_this(), data_part_storage_builder, columns_list, metadata_snapshot, indices_to_recalc,
shared_from_this(), data_part_storage_builder,
Nested::convertToSubcolumns(columns_list), metadata_snapshot, indices_to_recalc,
index_granularity_info.marks_file_extension,
default_codec_, writer_settings, computed_index_granularity);
}