2020-10-10 18:37:02 +00:00
|
|
|
#pragma once
|
2020-04-14 19:47:19 +00:00
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPartWriter.h>
|
|
|
|
#include <Storages/MergeTree/MergeTreeDataPartInMemory.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Writes data part in memory.
|
|
|
|
class MergeTreeDataPartWriterInMemory : public IMergeTreeDataPartWriter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MergeTreeDataPartWriterInMemory(
|
2022-10-22 22:51:59 +00:00
|
|
|
const MutableDataPartInMemoryPtr & 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-04-14 19:47:19 +00:00
|
|
|
const MergeTreeWriterSettings & settings_);
|
|
|
|
|
2020-06-03 13:27:54 +00:00
|
|
|
/// You can write only one block. In-memory part can be written only at INSERT.
|
2020-12-10 08:57:52 +00:00
|
|
|
void write(const Block & block, const IColumn::Permutation * permutation) override;
|
2020-04-14 19:47:19 +00:00
|
|
|
|
2022-02-01 10:36:51 +00:00
|
|
|
void fillChecksums(IMergeTreeDataPart::Checksums & checksums) override;
|
|
|
|
void finish(bool /*sync*/) override {}
|
2020-04-14 19:47:19 +00:00
|
|
|
|
|
|
|
private:
|
2020-12-10 08:57:52 +00:00
|
|
|
void calculateAndSerializePrimaryIndex(const Block & primary_index_block);
|
|
|
|
|
2022-10-22 22:51:59 +00:00
|
|
|
MutableDataPartInMemoryPtr part_in_memory;
|
2020-04-14 19:47:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|