mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 04:12:19 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <DataStreams/copyData.h>
|
|
#include <DataStreams/IBlockOutputStream.h>
|
|
#include <DataStreams/OneBlockInputStream.h>
|
|
#include <DataStreams/MaterializingBlockInputStream.h>
|
|
#include <Storages/StorageMaterializedView.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class ReplicatedMergeTreeBlockOutputStream;
|
|
|
|
|
|
/** Writes data to the specified table and to all dependent materialized views.
|
|
*/
|
|
class PushingToViewsBlockOutputStream : public IBlockOutputStream
|
|
{
|
|
public:
|
|
PushingToViewsBlockOutputStream(const StoragePtr & storage_,
|
|
const Context & context_, const ASTPtr & query_ptr_, bool no_destination = false);
|
|
|
|
Block getHeader() const override;
|
|
void write(const Block & block) override;
|
|
|
|
void flush() override;
|
|
void writePrefix() override;
|
|
void writeSuffix() override;
|
|
|
|
private:
|
|
StoragePtr storage;
|
|
BlockOutputStreamPtr output;
|
|
ReplicatedMergeTreeBlockOutputStream * replicated_output = nullptr;
|
|
|
|
const Context & context;
|
|
ASTPtr query_ptr;
|
|
|
|
struct ViewInfo
|
|
{
|
|
ASTPtr query;
|
|
StorageID table_id;
|
|
BlockOutputStreamPtr out;
|
|
};
|
|
|
|
std::vector<ViewInfo> views;
|
|
std::unique_ptr<Context> views_context;
|
|
|
|
void process(const Block & block, size_t view_num);
|
|
};
|
|
|
|
|
|
}
|