2019-06-18 12:54:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/MergeTree/IMergedBlockOutputStream.h>
|
2019-10-21 15:33:59 +00:00
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPart.h>
|
2019-06-18 12:54:27 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2019-10-22 17:42:59 +00:00
|
|
|
class MergeTreeDataPartWriterWide;
|
|
|
|
|
2019-06-18 12:54:27 +00:00
|
|
|
/// Writes only those columns that are in `header`
|
|
|
|
class MergedColumnOnlyOutputStream final : public IMergedBlockOutputStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// skip_offsets: used when ALTERing columns if we know that array offsets are not altered.
|
|
|
|
/// Pass empty 'already_written_offset_columns' first time then and pass the same object to subsequent instances of MergedColumnOnlyOutputStream
|
|
|
|
/// if you want to serialize elements of Nested data structure in different instances of MergedColumnOnlyOutputStream.
|
|
|
|
MergedColumnOnlyOutputStream(
|
2019-10-21 15:33:59 +00:00
|
|
|
const MergeTreeDataPartPtr & data_part, const Block & header_, bool sync_,
|
2019-06-18 12:54:27 +00:00
|
|
|
CompressionCodecPtr default_codec_, bool skip_offsets_,
|
2019-08-10 20:07:50 +00:00
|
|
|
const std::vector<MergeTreeIndexPtr> & indices_to_recalc_,
|
2019-08-03 11:02:40 +00:00
|
|
|
WrittenOffsetColumns & already_written_offset_columns_,
|
2019-08-19 10:37:04 +00:00
|
|
|
const MergeTreeIndexGranularityInfo * index_granularity_info_ = nullptr);
|
2019-06-18 12:54:27 +00:00
|
|
|
|
|
|
|
Block getHeader() const override { return header; }
|
|
|
|
void write(const Block & block) override;
|
|
|
|
void writeSuffix() override;
|
|
|
|
MergeTreeData::DataPart::Checksums writeSuffixAndGetChecksums();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Block header;
|
|
|
|
|
|
|
|
bool sync;
|
|
|
|
bool skip_offsets;
|
2019-06-24 13:44:44 +00:00
|
|
|
|
2019-06-18 12:54:27 +00:00
|
|
|
/// To correctly write Nested elements column-by-column.
|
|
|
|
WrittenOffsetColumns & already_written_offset_columns;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|