aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Interpreters/InterpreterSelectQueryAnalyzer.h
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-11-14 09:58:56 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-11-14 10:20:20 +0300
commitc2b2dfd9827a400a8495e172a56343462e3ceb82 (patch)
treecd4e4f597d01bede4c82dffeb2d780d0a9046bd0 /contrib/clickhouse/src/Interpreters/InterpreterSelectQueryAnalyzer.h
parentd4ae8f119e67808cb0cf776ba6e0cf95296f2df7 (diff)
downloadydb-c2b2dfd9827a400a8495e172a56343462e3ceb82.tar.gz
YQ Connector: move tests from yql to ydb (OSS)
Перенос папки с тестами на Коннектор из папки yql в папку ydb (синхронизируется с github).
Diffstat (limited to 'contrib/clickhouse/src/Interpreters/InterpreterSelectQueryAnalyzer.h')
-rw-r--r--contrib/clickhouse/src/Interpreters/InterpreterSelectQueryAnalyzer.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/Interpreters/InterpreterSelectQueryAnalyzer.h b/contrib/clickhouse/src/Interpreters/InterpreterSelectQueryAnalyzer.h
new file mode 100644
index 0000000000..4434fabe74
--- /dev/null
+++ b/contrib/clickhouse/src/Interpreters/InterpreterSelectQueryAnalyzer.h
@@ -0,0 +1,82 @@
+#pragma once
+
+#include <Interpreters/IInterpreter.h>
+#include <Interpreters/SelectQueryOptions.h>
+
+#include <Analyzer/QueryTreePassManager.h>
+#include <Planner/Planner.h>
+#include <Interpreters/Context_fwd.h>
+
+namespace DB
+{
+
+class InterpreterSelectQueryAnalyzer : public IInterpreter
+{
+public:
+ /// Initialize interpreter with query AST
+ InterpreterSelectQueryAnalyzer(const ASTPtr & query_,
+ const ContextPtr & context_,
+ const SelectQueryOptions & select_query_options_);
+
+ /** Initialize interpreter with query AST and storage.
+ * After query tree is built left most table expression is replaced with table node that
+ * is initialized with provided storage.
+ */
+ InterpreterSelectQueryAnalyzer(const ASTPtr & query_,
+ const ContextPtr & context_,
+ const StoragePtr & storage_,
+ const SelectQueryOptions & select_query_options_);
+
+ /// Initialize interpreter with query tree
+ InterpreterSelectQueryAnalyzer(const QueryTreeNodePtr & query_tree_,
+ const ContextPtr & context_,
+ const SelectQueryOptions & select_query_options_);
+
+ ContextPtr getContext() const
+ {
+ return context;
+ }
+
+ Block getSampleBlock();
+
+ static Block getSampleBlock(const ASTPtr & query,
+ const ContextPtr & context,
+ const SelectQueryOptions & select_query_options = {});
+
+ static Block getSampleBlock(const QueryTreeNodePtr & query_tree,
+ const ContextPtr & context_,
+ const SelectQueryOptions & select_query_options = {});
+
+ BlockIO execute() override;
+
+ QueryPlan & getQueryPlan();
+
+ QueryPlan && extractQueryPlan() &&;
+
+ QueryPipelineBuilder buildQueryPipeline();
+
+ void addStorageLimits(const StorageLimitsList & storage_limits);
+
+ bool supportsTransactions() const override { return true; }
+
+ bool ignoreLimits() const override { return select_query_options.ignore_limits; }
+
+ bool ignoreQuota() const override { return select_query_options.ignore_quota; }
+
+ /// Set number_of_current_replica and count_participating_replicas in client_info
+ void setProperClientInfo(size_t replica_number, size_t count_participating_replicas);
+
+ const Planner & getPlanner() const { return planner; }
+ Planner & getPlanner() { return planner; }
+
+ const QueryTreeNodePtr & getQueryTree() const { return query_tree; }
+
+private:
+ ASTPtr query;
+ ContextMutablePtr context;
+ SelectQueryOptions select_query_options;
+ QueryTreeNodePtr query_tree;
+ Planner planner;
+};
+
+}