2016-01-28 01:00:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Parsers/IAST.h>
|
|
|
|
#include <DB/Storages/IStorage.h>
|
2016-10-10 08:44:52 +00:00
|
|
|
#include <DB/Interpreters/Cluster.h>
|
2016-01-28 01:00:27 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-03-07 04:35:06 +00:00
|
|
|
struct Settings;
|
2016-01-28 01:00:27 +00:00
|
|
|
class Context;
|
|
|
|
class Cluster;
|
|
|
|
|
|
|
|
namespace ClusterProxy
|
|
|
|
{
|
|
|
|
|
|
|
|
class IQueryConstructor;
|
|
|
|
|
2016-03-28 13:00:00 +00:00
|
|
|
/// This class is designed for distributed queries execution. It hides from
|
|
|
|
/// the caller the details about the actual locations at which a distributed
|
|
|
|
/// query is performed. Depending on the type of query to be performed,
|
|
|
|
/// (currently SELECT, DESCRIBE, or ALTER (for resharding)), a so-called
|
|
|
|
/// query constructor is specified. Such an object states, among other things,
|
|
|
|
/// how connections must be allocated for remote execution.
|
2016-01-28 01:00:27 +00:00
|
|
|
class Query
|
|
|
|
{
|
|
|
|
public:
|
2016-10-10 08:44:52 +00:00
|
|
|
Query(IQueryConstructor & query_constructor_, const ClusterPtr & cluster_,
|
2016-01-28 01:00:27 +00:00
|
|
|
ASTPtr query_ast_, const Context & context_, const Settings & settings_, bool enable_shard_multiplexing_);
|
2016-03-28 13:00:00 +00:00
|
|
|
|
|
|
|
/// For each location at which we perform the query, create an input stream
|
|
|
|
/// from which we can fetch the result.
|
2016-01-28 01:00:27 +00:00
|
|
|
BlockInputStreams execute();
|
|
|
|
|
|
|
|
private:
|
|
|
|
IQueryConstructor & query_constructor;
|
2016-10-10 08:44:52 +00:00
|
|
|
ClusterPtr cluster;
|
2016-01-28 01:00:27 +00:00
|
|
|
ASTPtr query_ast;
|
|
|
|
const Context & context;
|
|
|
|
const Settings & settings;
|
|
|
|
bool enable_shard_multiplexing;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|