ClickHouse/src/Storages/MergeTree/MergeTreeSink.h

42 lines
899 B
C++
Raw Normal View History

2014-03-13 12:48:07 +00:00
#pragma once
2021-07-23 19:33:59 +00:00
#include <Processors/Sinks/SinkToStorage.h>
#include <Storages/StorageInMemoryMetadata.h>
2014-03-13 12:48:07 +00:00
2014-03-13 12:48:07 +00:00
namespace DB
{
class Block;
class StorageMergeTree;
2021-07-23 19:33:59 +00:00
class MergeTreeSink : public SinkToStorage
2014-03-13 12:48:07 +00:00
{
public:
2021-07-23 19:33:59 +00:00
MergeTreeSink(
StorageMergeTree & storage_,
const StorageMetadataPtr metadata_snapshot_,
size_t max_parts_per_block_,
ContextPtr context_)
2021-07-26 10:08:40 +00:00
: SinkToStorage(metadata_snapshot_->getSampleBlock())
2021-07-23 19:33:59 +00:00
, storage(storage_)
, metadata_snapshot(metadata_snapshot_)
, max_parts_per_block(max_parts_per_block_)
, context(context_)
2020-06-26 11:30:23 +00:00
{
}
2014-03-13 12:48:07 +00:00
2021-07-23 19:33:59 +00:00
String getName() const override { return "MergeTreeSink"; }
void consume(Chunk chunk) override;
2021-07-26 14:47:29 +00:00
void onStart() override;
2014-03-13 12:48:07 +00:00
private:
StorageMergeTree & storage;
StorageMetadataPtr metadata_snapshot;
size_t max_parts_per_block;
ContextPtr context;
2014-03-13 12:48:07 +00:00
};
}