2022-07-14 11:20:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/IInterpreter.h>
|
|
|
|
#include <Interpreters/SelectQueryOptions.h>
|
|
|
|
|
|
|
|
#include <Analyzer/QueryTreePassManager.h>
|
|
|
|
#include <Processors/QueryPlan/QueryPlan.h>
|
|
|
|
#include <Interpreters/Context_fwd.h>
|
|
|
|
|
2022-08-24 09:21:03 +00:00
|
|
|
#include <Planner/Planner.h>
|
|
|
|
|
2022-07-14 11:20:16 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2022-12-06 09:44:38 +00:00
|
|
|
class InterpreterSelectQueryAnalyzer : public IInterpreter
|
2022-07-14 11:20:16 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-07-18 17:20:28 +00:00
|
|
|
/// Initialize interpreter with query AST
|
2022-08-24 09:21:03 +00:00
|
|
|
InterpreterSelectQueryAnalyzer(const ASTPtr & query_,
|
2022-07-18 17:20:28 +00:00
|
|
|
const SelectQueryOptions & select_query_options_,
|
|
|
|
ContextPtr context_);
|
2022-07-14 11:20:16 +00:00
|
|
|
|
2022-08-31 15:21:17 +00:00
|
|
|
/// Initialize interpreter with query tree
|
|
|
|
InterpreterSelectQueryAnalyzer(const QueryTreeNodePtr & query_tree_,
|
|
|
|
const SelectQueryOptions & select_query_options_,
|
|
|
|
ContextPtr context_);
|
|
|
|
|
2022-12-06 09:44:38 +00:00
|
|
|
const ContextPtr & getContext() const
|
|
|
|
{
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
|
|
|
ContextPtr & getContext()
|
|
|
|
{
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
2022-07-14 11:20:16 +00:00
|
|
|
Block getSampleBlock();
|
|
|
|
|
|
|
|
BlockIO execute() override;
|
|
|
|
|
2022-10-12 11:26:02 +00:00
|
|
|
QueryPlan && extractQueryPlan() &&;
|
|
|
|
|
2022-12-14 17:43:49 +00:00
|
|
|
void addStorageLimits(const StorageLimitsList & storage_limits);
|
|
|
|
|
2022-07-14 11:20:16 +00:00
|
|
|
bool supportsTransactions() const override { return true; }
|
|
|
|
|
2022-10-12 11:26:02 +00:00
|
|
|
bool ignoreLimits() const override { return select_query_options.ignore_limits; }
|
|
|
|
|
|
|
|
bool ignoreQuota() const override { return select_query_options.ignore_quota; }
|
|
|
|
|
|
|
|
void extendQueryLogElemImpl(QueryLogElement & elem, const ASTPtr &, ContextPtr) const override;
|
|
|
|
|
2022-08-15 16:34:10 +00:00
|
|
|
private:
|
2022-07-18 17:20:28 +00:00
|
|
|
ASTPtr query;
|
|
|
|
QueryTreeNodePtr query_tree;
|
2022-07-14 11:20:16 +00:00
|
|
|
SelectQueryOptions select_query_options;
|
2022-12-06 09:44:38 +00:00
|
|
|
ContextPtr context;
|
2022-08-24 09:21:03 +00:00
|
|
|
Planner planner;
|
2022-07-14 11:20:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|