ClickHouse/src/Storages/MergeTree/IMergedBlockOutputStream.h

55 lines
1.5 KiB
C++
Raw Normal View History

#pragma once
2022-10-22 22:51:59 +00:00
#include "Storages/MergeTree/IDataPartStorage.h"
#include <Storages/MergeTree/MergeTreeIndexGranularity.h>
#include <Storages/MergeTree/MergeTreeData.h>
2019-10-20 23:36:27 +00:00
#include <Storages/MergeTree/IMergeTreeDataPart.h>
2019-10-21 15:33:59 +00:00
#include <Storages/MergeTree/IMergeTreeDataPartWriter.h>
namespace DB
{
2021-09-29 17:45:01 +00:00
class IMergedBlockOutputStream
{
public:
IMergedBlockOutputStream(
2022-10-22 22:51:59 +00:00
const MergeTreeMutableDataPartPtr & data_part,
2021-05-19 01:48:46 +00:00
const StorageMetadataPtr & metadata_snapshot_,
2021-10-29 17:21:02 +00:00
const NamesAndTypesList & columns_list,
bool reset_columns_);
2021-10-05 13:58:24 +00:00
virtual ~IMergedBlockOutputStream() = default;
using WrittenOffsetColumns = std::set<std::string>;
2021-10-05 13:58:24 +00:00
virtual void write(const Block & block) = 0;
const MergeTreeIndexGranularity & getIndexGranularity() const
2019-11-07 11:11:38 +00:00
{
return writer->getIndexGranularity();
}
protected:
/// Remove all columns marked expired in data_part. Also, clears checksums
/// and columns array. Return set of removed files names.
NameSet removeEmptyColumnsFromPart(
const MergeTreeDataPartPtr & data_part,
NamesAndTypesList & columns,
SerializationInfoByName & serialization_infos,
MergeTreeData::DataPart::Checksums & checksums);
2019-10-20 23:36:27 +00:00
const MergeTreeData & storage;
StorageMetadataPtr metadata_snapshot;
2022-10-22 22:51:59 +00:00
MutableDataPartStoragePtr data_part_storage;
IMergeTreeDataPart::MergeTreeWriterPtr writer;
2021-10-29 17:21:02 +00:00
bool reset_columns = false;
SerializationInfoByName new_serialization_infos;
};
using IMergedBlockOutputStreamPtr = std::shared_ptr<IMergedBlockOutputStream>;
}