2014-03-13 12:48:07 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <DataStreams/IBlockOutputStream.h>
|
2020-06-16 15:51:29 +00:00
|
|
|
#include <Storages/StorageInMemoryMetadata.h>
|
2014-03-13 12:48:07 +00:00
|
|
|
|
2016-10-24 02:02:37 +00:00
|
|
|
|
2014-03-13 12:48:07 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-06-25 00:01:10 +00:00
|
|
|
class Block;
|
|
|
|
class StorageMergeTree;
|
|
|
|
|
|
|
|
|
2014-03-13 12:48:07 +00:00
|
|
|
class MergeTreeBlockOutputStream : public IBlockOutputStream
|
|
|
|
{
|
|
|
|
public:
|
2020-12-04 16:25:30 +00:00
|
|
|
MergeTreeBlockOutputStream(StorageMergeTree & storage_, const StorageMetadataPtr metadata_snapshot_, size_t max_parts_per_block_, bool optimize_on_insert_)
|
2020-06-16 15:51:29 +00:00
|
|
|
: storage(storage_)
|
|
|
|
, metadata_snapshot(metadata_snapshot_)
|
|
|
|
, max_parts_per_block(max_parts_per_block_)
|
2020-12-04 16:25:30 +00:00
|
|
|
, optimize_on_insert(optimize_on_insert_)
|
2020-06-26 11:30:23 +00:00
|
|
|
{
|
|
|
|
}
|
2014-03-13 12:48:07 +00:00
|
|
|
|
2018-02-19 00:45:32 +00:00
|
|
|
Block getHeader() const override;
|
2017-06-25 00:01:10 +00:00
|
|
|
void write(const Block & block) override;
|
2020-11-29 15:08:02 +00:00
|
|
|
void writePrefix() override;
|
2014-03-13 12:48:07 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
StorageMergeTree & storage;
|
2020-06-16 15:51:29 +00:00
|
|
|
StorageMetadataPtr metadata_snapshot;
|
2019-03-29 09:33:39 +00:00
|
|
|
size_t max_parts_per_block;
|
2020-12-04 16:25:30 +00:00
|
|
|
bool optimize_on_insert;
|
2014-03-13 12:48:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|