ClickHouse/src/Storages/MergeTree/IMergedBlockOutputStream.h

49 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
#include <Storages/MergeTree/MergeTreeIndexGranularity.h>
#include <Storages/MergeTree/MergeTreeData.h>
#include <DataStreams/IBlockOutputStream.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
{
class IMergedBlockOutputStream : public IBlockOutputStream
{
public:
IMergedBlockOutputStream(
const MergeTreeDataPartPtr & data_part,
const StorageMetadataPtr & metadata_snapshot_);
using WrittenOffsetColumns = std::set<std::string>;
2019-11-07 11:11:38 +00:00
const MergeTreeIndexGranularity & getIndexGranularity()
{
return writer->getIndexGranularity();
}
protected:
using SerializationState = IDataType::SerializeBinaryBulkStatePtr;
2020-04-17 11:59:10 +00:00
IDataType::OutputStreamGetter createStreamGetter(const String & name, WrittenOffsetColumns & offset_columns);
/// Remove all columns marked expired in data_part. Also, clears checksums
/// and columns array. Return set of removed files names.
static NameSet removeEmptyColumnsFromPart(
const MergeTreeDataPartPtr & data_part,
NamesAndTypesList & columns,
MergeTreeData::DataPart::Checksums & checksums);
protected:
2019-10-20 23:36:27 +00:00
const MergeTreeData & storage;
StorageMetadataPtr metadata_snapshot;
VolumePtr volume;
2019-07-28 11:10:35 +00:00
String part_path;
IMergeTreeDataPart::MergeTreeWriterPtr writer;
};
}