#pragma once #include #include 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; }; }