ColumnSparse: fix TTL

This commit is contained in:
Anton Popov 2021-04-20 15:13:46 +03:00
parent f2c4e0ff01
commit d571d099bd
2 changed files with 13 additions and 3 deletions

View File

@ -104,6 +104,9 @@ Block TTLBlockInputStream::readImpl()
return {};
auto block = children.at(0)->read();
for (auto & column : block)
column.column = recursiveRemoveSparse(column.column);
for (const auto & algorithm : algorithms)
algorithm->execute(block);

View File

@ -29,15 +29,23 @@ NameSet IMergedBlockOutputStream::removeEmptyColumnsFromPart(
/// Collect counts for shared streams of different columns. As an example, Nested columns have shared stream with array sizes.
std::map<String, size_t> stream_counts;
std::unordered_map<String, SerializationPtr> serialziations;
for (const NameAndTypePair & column : columns)
{
auto serialization = data_part->getSerializationForColumn(column);
auto serialization = IDataType::getSerialization(column, [&](const String & stream_name)
{
/// Checksums of data_part are not initialized here.
return checksums.files.count(stream_name + IMergeTreeDataPart::DATA_FILE_EXTENSION) != 0;
});
serialization->enumerateStreams(
[&](const ISerialization::SubstreamPath & substream_path)
{
++stream_counts[ISerialization::getFileNameForStream(column, substream_path)];
},
{});
serialziations[column.name] = std::move(serialization);
}
NameSet remove_files;
@ -59,8 +67,7 @@ NameSet IMergedBlockOutputStream::removeEmptyColumnsFromPart(
}
};
auto serialization = data_part->getSerializationForColumn(*column_with_type);
serialization->enumerateStreams(callback);
serialziations[column_name]->enumerateStreams(callback);
}
/// Remove files on disk and checksums