ClickHouse/src/Storages/MergeTree/IMergeTreeDataPartWriter.h
Nikolai Kochetov 4aa6e4d683 Revert "Add return flag for preFinalize."
This reverts commit 3261378ef8.
2023-02-09 19:51:09 +00:00

56 lines
1.7 KiB
C++

#pragma once
#include <IO/WriteBufferFromFile.h>
#include <IO/WriteBufferFromFileBase.h>
#include <Compression/CompressedWriteBuffer.h>
#include <IO/HashingWriteBuffer.h>
#include <Storages/MergeTree/MergeTreeData.h>
#include <Storages/MergeTree/IMergeTreeDataPart.h>
#include <Disks/IDisk.h>
namespace DB
{
Block getBlockAndPermute(const Block & block, const Names & names, const IColumn::Permutation * permutation);
Block permuteBlockIfNeeded(const Block & block, const IColumn::Permutation * permutation);
/// Writes data part to disk in different formats.
/// Calculates and serializes primary and skip indices if needed.
class IMergeTreeDataPartWriter : private boost::noncopyable
{
public:
IMergeTreeDataPartWriter(
const MergeTreeMutableDataPartPtr & data_part_,
const NamesAndTypesList & columns_list_,
const StorageMetadataPtr & metadata_snapshot_,
const MergeTreeWriterSettings & settings_,
const MergeTreeIndexGranularity & index_granularity_ = {});
virtual ~IMergeTreeDataPartWriter();
virtual void write(const Block & block, const IColumn::Permutation * permutation) = 0;
virtual void fillChecksums(IMergeTreeDataPart::Checksums & checksums) = 0;
virtual void finish(bool sync) = 0;
Columns releaseIndexColumns();
const MergeTreeIndexGranularity & getIndexGranularity() const { return index_granularity; }
protected:
const MergeTreeMutableDataPartPtr data_part;
const MergeTreeData & storage;
const StorageMetadataPtr metadata_snapshot;
const NamesAndTypesList columns_list;
const MergeTreeWriterSettings settings;
MergeTreeIndexGranularity index_granularity;
const bool with_final_mark;
MutableColumns index_columns;
};
}