Reorganize query directory tree
Summary: Move query/frontend/interpret to query/interpret. Split interpret.hpp to frame.hpp and eval.hpp. Move query/frontend/logical to query/plan. Nest namespace frontend::opencypher inside query. Reviewers: florijan, mislav.bradac, buda Reviewed By: florijan Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D272
This commit is contained in:
parent
c89c65a748
commit
3b27b20992
@ -362,9 +362,9 @@ set(memgraph_src_files
|
||||
${src_dir}/query/console.cpp
|
||||
${src_dir}/query/frontend/ast/cypher_main_visitor.cpp
|
||||
${src_dir}/query/typed_value.cpp
|
||||
${src_dir}/query/frontend/interpret/awesome_memgraph_functions.cpp
|
||||
${src_dir}/query/frontend/logical/operator.cpp
|
||||
${src_dir}/query/frontend/logical/planner.cpp
|
||||
${src_dir}/query/interpret/awesome_memgraph_functions.cpp
|
||||
${src_dir}/query/plan/operator.cpp
|
||||
${src_dir}/query/plan/planner.cpp
|
||||
${src_dir}/query/frontend/semantic/symbol_generator.cpp
|
||||
)
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -142,7 +142,7 @@ private:
|
||||
auto generated_path = fs::path(CONFIG(config::COMPILE_PATH) +
|
||||
std::to_string(stripped.hash) + ".cpp");
|
||||
|
||||
frontend::opencypher::Parser parser(stripped.query);
|
||||
query::frontend::opencypher::Parser parser(stripped.query);
|
||||
// backend::cpp::Generator(parser.tree(), stripped.query, stripped.hash,
|
||||
// generated_path);
|
||||
return LoadCpp(generated_path, stripped.hash);
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "database/graph_db.hpp"
|
||||
#include "query/exceptions.hpp"
|
||||
#include "query/frontend/interpret/awesome_memgraph_functions.hpp"
|
||||
#include "query/interpret/awesome_memgraph_functions.hpp"
|
||||
#include "utils/assert.hpp"
|
||||
|
||||
namespace query {
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "query/frontend/opencypher/generated/CypherLexer.h"
|
||||
#include "query/frontend/opencypher/generated/CypherParser.h"
|
||||
|
||||
namespace query {
|
||||
namespace frontend {
|
||||
namespace opencypher {
|
||||
|
||||
@ -59,5 +60,6 @@ class Parser {
|
||||
CypherParser parser_{&tokens_};
|
||||
tree::ParseTree *tree_ = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace opencypher
|
||||
} // namespace frontend
|
||||
} // namespace query
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "query/frontend/interpret/awesome_memgraph_functions.hpp"
|
||||
#include "query/interpret/awesome_memgraph_functions.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
@ -5,28 +5,13 @@
|
||||
|
||||
#include "query/frontend/ast/ast.hpp"
|
||||
#include "query/frontend/semantic/symbol_table.hpp"
|
||||
#include "query/interpret/frame.hpp"
|
||||
#include "query/typed_value.hpp"
|
||||
#include "utils/assert.hpp"
|
||||
#include "utils/exceptions/not_yet_implemented.hpp"
|
||||
|
||||
namespace query {
|
||||
|
||||
class Frame {
|
||||
public:
|
||||
Frame(int size) : size_(size), elems_(size_) {}
|
||||
|
||||
TypedValue &operator[](const Symbol &symbol) {
|
||||
return elems_[symbol.position_];
|
||||
}
|
||||
const TypedValue &operator[](const Symbol &symbol) const {
|
||||
return elems_[symbol.position_];
|
||||
}
|
||||
|
||||
private:
|
||||
int size_;
|
||||
std::vector<TypedValue> elems_;
|
||||
};
|
||||
|
||||
class ExpressionEvaluator : public TreeVisitorBase {
|
||||
public:
|
||||
ExpressionEvaluator(Frame &frame, const SymbolTable &symbol_table)
|
26
src/query/interpret/frame.hpp
Normal file
26
src/query/interpret/frame.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "query/frontend/semantic/symbol_table.hpp"
|
||||
#include "query/typed_value.hpp"
|
||||
|
||||
namespace query {
|
||||
|
||||
class Frame {
|
||||
public:
|
||||
Frame(int size) : size_(size), elems_(size_) {}
|
||||
|
||||
TypedValue &operator[](const Symbol &symbol) {
|
||||
return elems_[symbol.position_];
|
||||
}
|
||||
const TypedValue &operator[](const Symbol &symbol) const {
|
||||
return elems_[symbol.position_];
|
||||
}
|
||||
|
||||
private:
|
||||
int size_;
|
||||
std::vector<TypedValue> elems_;
|
||||
};
|
||||
|
||||
} // namespace query
|
@ -5,10 +5,10 @@
|
||||
#include "database/graph_db_accessor.hpp"
|
||||
#include "query/context.hpp"
|
||||
#include "query/frontend/ast/cypher_main_visitor.hpp"
|
||||
#include "query/frontend/interpret/interpret.hpp"
|
||||
#include "query/frontend/logical/planner.hpp"
|
||||
#include "query/frontend/opencypher/parser.hpp"
|
||||
#include "query/frontend/semantic/symbol_generator.hpp"
|
||||
#include "query/interpret/frame.hpp"
|
||||
#include "query/plan/planner.hpp"
|
||||
|
||||
namespace query {
|
||||
|
||||
@ -22,7 +22,7 @@ void Interpret(const std::string &query, GraphDbAccessor &db_accessor,
|
||||
std::map<std::string, TypedValue> summary;
|
||||
|
||||
// query -> AST
|
||||
::frontend::opencypher::Parser parser(query);
|
||||
frontend::opencypher::Parser parser(query);
|
||||
auto low_level_tree = parser.tree();
|
||||
|
||||
// AST -> high level tree
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "query/frontend/logical/operator.hpp"
|
||||
#include "query/plan/operator.hpp"
|
||||
|
||||
#include "query/exceptions.hpp"
|
||||
#include "query/frontend/ast/ast.hpp"
|
||||
#include "query/frontend/interpret/interpret.hpp"
|
||||
#include "query/interpret/eval.hpp"
|
||||
|
||||
namespace query {
|
||||
namespace plan {
|
@ -1,4 +1,4 @@
|
||||
#include "query/frontend/logical/planner.hpp"
|
||||
#include "query/plan/planner.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <unordered_set>
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "query/frontend/logical/operator.hpp"
|
||||
#include "query/plan/operator.hpp"
|
||||
|
||||
namespace query {
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "query/frontend/ast/ast.hpp"
|
||||
#include "query/frontend/interpret/awesome_memgraph_functions.hpp"
|
||||
#include "query/frontend/interpret/interpret.hpp"
|
||||
#include "query/frontend/opencypher/parser.hpp"
|
||||
#include "query/interpret/awesome_memgraph_functions.hpp"
|
||||
#include "query/interpret/eval.hpp"
|
||||
|
||||
using namespace query;
|
||||
|
||||
|
@ -15,8 +15,7 @@
|
||||
#include "dbms/dbms.hpp"
|
||||
#include "query/context.hpp"
|
||||
#include "query/exceptions.hpp"
|
||||
#include "query/frontend/interpret/interpret.hpp"
|
||||
#include "query/frontend/logical/operator.hpp"
|
||||
#include "query/plan/operator.hpp"
|
||||
|
||||
#include "query_plan_common.hpp"
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "query/frontend/semantic/symbol_table.hpp"
|
||||
#include "query/frontend/interpret/interpret.hpp"
|
||||
#include "query/interpret/frame.hpp"
|
||||
|
||||
#include "query_common.hpp"
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include "dbms/dbms.hpp"
|
||||
#include "query/context.hpp"
|
||||
#include "query/exceptions.hpp"
|
||||
#include "query/frontend/interpret/interpret.hpp"
|
||||
#include "query/frontend/logical/operator.hpp"
|
||||
#include "query/interpret/frame.hpp"
|
||||
#include "query/plan/operator.hpp"
|
||||
|
||||
#include "query_plan_common.hpp"
|
||||
|
||||
|
@ -14,8 +14,7 @@
|
||||
#include "dbms/dbms.hpp"
|
||||
#include "query/context.hpp"
|
||||
#include "query/exceptions.hpp"
|
||||
#include "query/frontend/interpret/interpret.hpp"
|
||||
#include "query/frontend/logical/operator.hpp"
|
||||
#include "query/plan/operator.hpp"
|
||||
|
||||
#include "query_plan_common.hpp"
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
#include "dbms/dbms.hpp"
|
||||
#include "query/frontend/ast/ast.hpp"
|
||||
#include "query/frontend/logical/operator.hpp"
|
||||
#include "query/frontend/logical/planner.hpp"
|
||||
#include "query/frontend/semantic/symbol_generator.hpp"
|
||||
#include "query/frontend/semantic/symbol_table.hpp"
|
||||
#include "query/plan/operator.hpp"
|
||||
#include "query/plan/planner.hpp"
|
||||
|
||||
#include "query_common.hpp"
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "dbms/dbms.hpp"
|
||||
#include "query/frontend/ast/ast.hpp"
|
||||
#include "query/frontend/interpret/interpret.hpp"
|
||||
#include "query/frontend/semantic/symbol_table.hpp"
|
||||
#include "query/frontend/semantic/symbol_generator.hpp"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user