ClickHouse/src/Storages/MergeTree/IMergeTreeDataPartWriter.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
1.7 KiB
C++
Raw Normal View History

2019-10-21 15:33:59 +00:00
#pragma once
2019-10-16 18:27:53 +00:00
#include <IO/WriteBufferFromFile.h>
2019-10-19 16:49:36 +00:00
#include <IO/WriteBufferFromFileBase.h>
2019-10-16 18:27:53 +00:00
#include <Compression/CompressedWriteBuffer.h>
#include <IO/HashingWriteBuffer.h>
#include <Storages/MergeTree/MergeTreeData.h>
2019-11-05 11:53:22 +00:00
#include <Storages/MergeTree/IMergeTreeDataPart.h>
#include <Disks/IDisk.h>
2019-10-16 18:27:53 +00:00
namespace DB
{
2020-12-10 08:57:52 +00:00
Block getBlockAndPermute(const Block & block, const Names & names, const IColumn::Permutation * permutation);
2020-02-03 12:08:40 +00:00
2020-12-14 14:27:39 +00:00
Block permuteBlockIfNeeded(const Block & block, const IColumn::Permutation * permutation);
2020-02-03 12:08:40 +00:00
/// Writes data part to disk in different formats.
/// Calculates and serializes primary and skip indices if needed.
2019-12-27 21:17:53 +00:00
class IMergeTreeDataPartWriter : private boost::noncopyable
2019-10-16 18:27:53 +00:00
{
public:
2020-04-14 19:47:19 +00:00
IMergeTreeDataPartWriter(
2022-10-22 22:51:59 +00:00
const MergeTreeMutableDataPartPtr & data_part_,
2020-04-14 19:47:19 +00:00
const NamesAndTypesList & columns_list_,
2020-06-26 11:30:23 +00:00
const StorageMetadataPtr & metadata_snapshot_,
2020-12-10 09:22:43 +00:00
const MergeTreeWriterSettings & settings_,
const MergeTreeIndexGranularity & index_granularity_ = {});
2019-10-19 16:49:36 +00:00
virtual ~IMergeTreeDataPartWriter();
2020-12-10 08:57:52 +00:00
virtual void write(const Block & block, const IColumn::Permutation * permutation) = 0;
2019-10-21 17:23:06 +00:00
virtual void fillChecksums(IMergeTreeDataPart::Checksums & checksums) = 0;
virtual void finish(bool sync) = 0;
2019-10-21 15:33:59 +00:00
2020-04-14 01:27:27 +00:00
Columns releaseIndexColumns();
const MergeTreeIndexGranularity & getIndexGranularity() const { return index_granularity; }
2019-10-16 18:27:53 +00:00
protected:
2020-12-10 08:57:52 +00:00
2022-10-22 22:51:59 +00:00
const MergeTreeMutableDataPartPtr data_part;
2019-10-20 23:36:27 +00:00
const MergeTreeData & storage;
2020-12-09 18:10:09 +00:00
const StorageMetadataPtr metadata_snapshot;
const NamesAndTypesList columns_list;
const MergeTreeWriterSettings settings;
2020-12-10 09:22:43 +00:00
MergeTreeIndexGranularity index_granularity;
2020-12-09 18:10:09 +00:00
const bool with_final_mark;
2019-11-05 11:53:22 +00:00
MutableColumns index_columns;
2019-10-16 18:27:53 +00:00
};
2019-10-19 16:49:36 +00:00
}