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