mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
42 lines
899 B
C++
42 lines
899 B
C++
#pragma once
|
|
|
|
#include <Processors/Sinks/SinkToStorage.h>
|
|
#include <Storages/StorageInMemoryMetadata.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class Block;
|
|
class StorageMergeTree;
|
|
|
|
|
|
class MergeTreeSink : public SinkToStorage
|
|
{
|
|
public:
|
|
MergeTreeSink(
|
|
StorageMergeTree & storage_,
|
|
const StorageMetadataPtr metadata_snapshot_,
|
|
size_t max_parts_per_block_,
|
|
ContextPtr context_)
|
|
: SinkToStorage(metadata_snapshot_->getSampleBlock())
|
|
, storage(storage_)
|
|
, metadata_snapshot(metadata_snapshot_)
|
|
, max_parts_per_block(max_parts_per_block_)
|
|
, context(context_)
|
|
{
|
|
}
|
|
|
|
String getName() const override { return "MergeTreeSink"; }
|
|
void consume(Chunk chunk) override;
|
|
void onStart() override;
|
|
|
|
private:
|
|
StorageMergeTree & storage;
|
|
StorageMetadataPtr metadata_snapshot;
|
|
size_t max_parts_per_block;
|
|
ContextPtr context;
|
|
};
|
|
|
|
}
|