1#pragma once
2
3#include <Core/QueryProcessingStage.h>
4#include <Interpreters/ClusterProxy/IStreamFactory.h>
5#include <Storages/IStorage_fwd.h>
6
7namespace DB
8{
9
10namespace ClusterProxy
11{
12
13class SelectStreamFactory final : public IStreamFactory
14{
15public:
16 /// Database in a query.
17 SelectStreamFactory(
18 const Block & header_,
19 QueryProcessingStage::Enum processed_stage_,
20 QualifiedTableName main_table_,
21 const Scalars & scalars_,
22 bool has_virtual_shard_num_column_,
23 const Tables & external_tables);
24
25 /// TableFunction in a query.
26 SelectStreamFactory(
27 const Block & header_,
28 QueryProcessingStage::Enum processed_stage_,
29 ASTPtr table_func_ptr_,
30 const Scalars & scalars_,
31 bool has_virtual_shard_num_column_,
32 const Tables & external_tables_);
33
34 void createForShard(
35 const Cluster::ShardInfo & shard_info,
36 const String & query, const ASTPtr & query_ast,
37 const Context & context, const ThrottlerPtr & throttler,
38 BlockInputStreams & res) override;
39
40private:
41 const Block header;
42 QueryProcessingStage::Enum processed_stage;
43 QualifiedTableName main_table;
44 ASTPtr table_func_ptr;
45 Scalars scalars;
46 bool has_virtual_shard_num_column = false;
47 Tables external_tables;
48};
49
50}
51
52}
53