Separate query types in AST and interpreter
Summary: `Query` is now an abstract class which has `CypherQuery`, `ExplainQuery`, `IndexQuery`, `AuthQuery` and `StreamQuery` as derived classes. Only `CypherQuery` is forwarded to planner and the rest of the queries are handled directly in the interpreter. This enabled us to remove auth, explain and stream operators, clean up `Context` class and remove coupling between `Results` class and plan cache. This should make it easier to add similar functionality because no logical operator boilerplate is needed. It should also be easier to separate community and enterprise features for open source. Remove Explain logical operator Separate IndexQuery in AST Handle index creation in interpreter Remove CreateIndex operator and ast nodes Remove plan cache reference from Results Move auth queries out of operator tree Remove auth from context Fix tests, separate stream queries Remove in_explicit_transaction and streams from context Reviewers: teon.banek, mferencevic, msantl Reviewed By: teon.banek, mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1664
This commit is contained in:
@@ -453,7 +453,7 @@ query::SymbolTable MakeSymbolTable(query::Query *query) {
|
||||
|
||||
// Returns a list of pairs (plan, estimated cost), sorted in the ascending
|
||||
// order by cost.
|
||||
auto MakeLogicalPlans(query::Query *query, query::AstStorage &ast,
|
||||
auto MakeLogicalPlans(query::CypherQuery *query, query::AstStorage &ast,
|
||||
query::SymbolTable &symbol_table,
|
||||
InteractiveDbAccessor &dba) {
|
||||
auto query_parts = query::plan::CollectQueryParts(symbol_table, ast, query);
|
||||
@@ -501,7 +501,13 @@ void RunInteractivePlanning(database::GraphDbAccessor *dba) {
|
||||
if (line->empty()) continue;
|
||||
try {
|
||||
query::AstStorage ast;
|
||||
auto *query = MakeAst(*line, &ast, *dba);
|
||||
auto *query =
|
||||
dynamic_cast<query::CypherQuery *>(MakeAst(*line, &ast, *dba));
|
||||
if (!query) {
|
||||
throw utils::BasicException(
|
||||
"Interactive planning is only avaialable for regular openCypher "
|
||||
"queries.");
|
||||
}
|
||||
auto symbol_table = MakeSymbolTable(query);
|
||||
planning_timer.Start();
|
||||
auto plans = MakeLogicalPlans(query, ast, symbol_table, interactive_db);
|
||||
|
||||
Reference in New Issue
Block a user