mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 02:12:21 +00:00
56 lines
1.7 KiB
C++
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, NameSet & checksums_to_remove) = 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;
|
|
};
|
|
|
|
}
|