Rename AstTreeStorage to AstStorage

Summary: happiness

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1403
This commit is contained in:
Marin Tomic 2018-05-22 16:45:52 +02:00
parent 34e2a4f0ff
commit 3948cea83c
31 changed files with 650 additions and 650 deletions

View File

@ -16,14 +16,14 @@ class PlanConsumer {
public:
struct PlanPack {
PlanPack(std::shared_ptr<query::plan::LogicalOperator> plan,
query::SymbolTable symbol_table, query::AstTreeStorage storage)
query::SymbolTable symbol_table, query::AstStorage storage)
: plan(plan),
symbol_table(std::move(symbol_table)),
storage(std::move(storage)) {}
std::shared_ptr<query::plan::LogicalOperator> plan;
query::SymbolTable symbol_table;
const query::AstTreeStorage storage;
const query::AstStorage storage;
};
explicit PlanConsumer(communication::rpc::Server &server);

View File

@ -46,7 +46,7 @@ cpp<#
:capnp-type "Utils.SharedPtr(Plan.LogicalOperator)"
:capnp-save #'save-plan :capnp-load #'load-plan)
(symbol-table "query::SymbolTable" :capnp-type "Sem.SymbolTable")
(storage "query::AstTreeStorage" :initarg nil
(storage "query::AstStorage" :initarg nil
:save-fun ""
:load-fun "storage = std::move(ar.template get_helper<query::AstTreeStorage>(query::AstTreeStorage::kHelperId));"
:capnp-save :dont-save)))

View File

@ -14,23 +14,23 @@ namespace query {
// isn't unique, then different instances (even across different types!) will
// replace the previous helper. The documentation recommends to take an address
// of a function, which should be unique in the produced binary.
// It might seem logical to take an address of a AstTreeStorage constructor, but
// It might seem logical to take an address of a AstStorage constructor, but
// according to c++ standard, the constructor function need not have an address.
// Additionally, pointers to member functions are not required to contain the
// address of the function
// (https://isocpp.org/wiki/faq/pointers-to-members#addr-of-memfn). So, to be
// safe, use a regular top-level function.
void *const AstTreeStorage::kHelperId = (void *)CloneReturnBody;
void *const AstStorage::kHelperId = (void *)CloneReturnBody;
AstTreeStorage::AstTreeStorage() {
AstStorage::AstStorage() {
storage_.emplace_back(new Query(next_uid_++));
}
Query *AstTreeStorage::query() const {
Query *AstStorage::query() const {
return dynamic_cast<Query *>(storage_[0].get());
}
ReturnBody CloneReturnBody(AstTreeStorage &storage, const ReturnBody &body) {
ReturnBody CloneReturnBody(AstStorage &storage, const ReturnBody &body) {
ReturnBody new_body;
new_body.distinct = body.distinct;
new_body.all_identifiers = body.all_identifiers;
@ -47,7 +47,7 @@ ReturnBody CloneReturnBody(AstTreeStorage &storage, const ReturnBody &body) {
// Capnproto serialization.
Tree *AstTreeStorage::Load(const capnp::Tree::Reader &tree,
Tree *AstStorage::Load(const capnp::Tree::Reader &tree,
std::vector<int> *loaded_uids) {
auto uid = tree.getUid();
@ -137,7 +137,7 @@ bool Tree::IsSaved(const std::vector<int> &saved_uids) {
return utils::Contains(saved_uids, uid_);
}
void Tree::Load(const capnp::Tree::Reader &reader, AstTreeStorage *storage,
void Tree::Load(const capnp::Tree::Reader &reader, AstStorage *storage,
std::vector<int> *loaded_uids) {
uid_ = reader.getUid();
}
@ -159,7 +159,7 @@ void Expression::Save(capnp::Tree::Builder *tree_builder,
}
Expression *Expression::Construct(const capnp::Expression::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
switch (reader.which()) {
case capnp::Expression::BINARY_OPERATOR: {
auto bop_reader = reader.getBinaryOperator();
@ -225,7 +225,7 @@ void BaseLiteral::Save(capnp::Expression::Builder *expr_builder,
}
BaseLiteral *BaseLiteral::Construct(const capnp::BaseLiteral::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
switch (reader.which()) {
case capnp::BaseLiteral::PRIMITIVE_LITERAL: {
auto literal = reader.getPrimitiveLiteral();
@ -253,7 +253,7 @@ void PrimitiveLiteral::Save(capnp::BaseLiteral::Builder *base_literal_builder,
}
void PrimitiveLiteral::Load(const capnp::Tree::Reader &reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
BaseLiteral::Load(reader, storage, loaded_uids);
auto pl_reader =
@ -264,7 +264,7 @@ void PrimitiveLiteral::Load(const capnp::Tree::Reader &reader,
}
PrimitiveLiteral *PrimitiveLiteral::Construct(
const capnp::PrimitiveLiteral::Reader &reader, AstTreeStorage *storage) {
const capnp::PrimitiveLiteral::Reader &reader, AstStorage *storage) {
return storage->Create<PrimitiveLiteral>();
}
@ -282,7 +282,7 @@ void ListLiteral::Save(capnp::BaseLiteral::Builder *base_literal_builder,
}
void ListLiteral::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
BaseLiteral::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getBaseLiteral().getListLiteral();
for (const auto tree_reader : reader.getElements()) {
@ -292,7 +292,7 @@ void ListLiteral::Load(const capnp::Tree::Reader &base_reader,
}
ListLiteral *ListLiteral::Construct(const capnp::ListLiteral::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<ListLiteral>();
}
@ -317,7 +317,7 @@ void MapLiteral::Save(capnp::BaseLiteral::Builder *base_literal_builder,
}
void MapLiteral::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
BaseLiteral::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getBaseLiteral().getMapLiteral();
for (auto entry_reader : reader.getElements()) {
@ -335,7 +335,7 @@ void MapLiteral::Load(const capnp::Tree::Reader &base_reader,
}
MapLiteral *MapLiteral::Construct(const capnp::MapLiteral::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<MapLiteral>();
}
@ -360,7 +360,7 @@ void BinaryOperator::Save(capnp::BinaryOperator::Builder *builder,
}
void BinaryOperator::Load(const capnp::Tree::Reader &reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
Expression::Load(reader, storage, loaded_uids);
auto bop_reader = reader.getExpression().getBinaryOperator();
@ -377,7 +377,7 @@ void BinaryOperator::Load(const capnp::Tree::Reader &reader,
}
BinaryOperator *BinaryOperator::Construct(
const capnp::BinaryOperator::Reader &reader, AstTreeStorage *storage) {
const capnp::BinaryOperator::Reader &reader, AstStorage *storage) {
switch (reader.which()) {
case capnp::BinaryOperator::ADDITION_OPERATOR: {
auto literal = reader.getAdditionOperator();
@ -457,7 +457,7 @@ void OrOperator::Save(capnp::BinaryOperator::Builder *builder,
}
OrOperator *OrOperator::Construct(const capnp::OrOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<OrOperator>();
}
@ -468,7 +468,7 @@ void XorOperator::Save(capnp::BinaryOperator::Builder *builder,
}
XorOperator *XorOperator::Construct(const capnp::XorOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<XorOperator>();
}
@ -479,7 +479,7 @@ void AndOperator::Save(capnp::BinaryOperator::Builder *builder,
}
AndOperator *AndOperator::Construct(const capnp::AndOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<AndOperator>();
}
@ -490,7 +490,7 @@ void AdditionOperator::Save(capnp::BinaryOperator::Builder *builder,
}
AdditionOperator *AdditionOperator::Construct(
const capnp::AdditionOperator::Reader &, AstTreeStorage *storage) {
const capnp::AdditionOperator::Reader &, AstStorage *storage) {
return storage->Create<AdditionOperator>();
}
@ -501,7 +501,7 @@ void SubtractionOperator::Save(capnp::BinaryOperator::Builder *builder,
}
SubtractionOperator *SubtractionOperator::Construct(
capnp::SubtractionOperator::Reader &, AstTreeStorage *storage) {
capnp::SubtractionOperator::Reader &, AstStorage *storage) {
return storage->Create<SubtractionOperator>();
}
@ -512,7 +512,7 @@ void MultiplicationOperator::Save(capnp::BinaryOperator::Builder *builder,
}
MultiplicationOperator *MultiplicationOperator::Construct(
capnp::MultiplicationOperator::Reader &, AstTreeStorage *storage) {
capnp::MultiplicationOperator::Reader &, AstStorage *storage) {
return storage->Create<MultiplicationOperator>();
}
@ -523,7 +523,7 @@ void DivisionOperator::Save(capnp::BinaryOperator::Builder *builder,
}
DivisionOperator *DivisionOperator::Construct(
const capnp::DivisionOperator::Reader &, AstTreeStorage *storage) {
const capnp::DivisionOperator::Reader &, AstStorage *storage) {
return storage->Create<DivisionOperator>();
}
@ -534,7 +534,7 @@ void ModOperator::Save(capnp::BinaryOperator::Builder *builder,
}
ModOperator *ModOperator::Construct(const capnp::ModOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<ModOperator>();
}
@ -545,7 +545,7 @@ void NotEqualOperator::Save(capnp::BinaryOperator::Builder *builder,
}
NotEqualOperator *NotEqualOperator::Construct(
const capnp::NotEqualOperator::Reader &, AstTreeStorage *storage) {
const capnp::NotEqualOperator::Reader &, AstStorage *storage) {
return storage->Create<NotEqualOperator>();
}
@ -556,7 +556,7 @@ void EqualOperator::Save(capnp::BinaryOperator::Builder *builder,
}
EqualOperator *EqualOperator::Construct(const capnp::EqualOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<EqualOperator>();
}
@ -567,7 +567,7 @@ void LessOperator::Save(capnp::BinaryOperator::Builder *builder,
}
LessOperator *LessOperator::Construct(const capnp::LessOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<LessOperator>();
}
@ -578,7 +578,7 @@ void GreaterOperator::Save(capnp::BinaryOperator::Builder *builder,
}
GreaterOperator *GreaterOperator::Construct(
const capnp::GreaterOperator::Reader &, AstTreeStorage *storage) {
const capnp::GreaterOperator::Reader &, AstStorage *storage) {
return storage->Create<GreaterOperator>();
}
@ -589,7 +589,7 @@ void LessEqualOperator::Save(capnp::BinaryOperator::Builder *builder,
}
LessEqualOperator *LessEqualOperator::Construct(
const capnp::LessEqualOperator::Reader &, AstTreeStorage *storage) {
const capnp::LessEqualOperator::Reader &, AstStorage *storage) {
return storage->Create<LessEqualOperator>();
}
@ -600,7 +600,7 @@ void GreaterEqualOperator::Save(capnp::BinaryOperator::Builder *builder,
}
GreaterEqualOperator *GreaterEqualOperator::Construct(
const capnp::GreaterEqualOperator::Reader &, AstTreeStorage *storage) {
const capnp::GreaterEqualOperator::Reader &, AstStorage *storage) {
return storage->Create<GreaterEqualOperator>();
}
@ -611,7 +611,7 @@ void InListOperator::Save(capnp::BinaryOperator::Builder *builder,
}
InListOperator *InListOperator::Construct(const capnp::InListOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<InListOperator>();
}
@ -622,7 +622,7 @@ void ListMapIndexingOperator::Save(capnp::BinaryOperator::Builder *builder,
}
ListMapIndexingOperator *ListMapIndexingOperator::Construct(
capnp::ListMapIndexingOperator::Reader &, AstTreeStorage *storage) {
capnp::ListMapIndexingOperator::Reader &, AstStorage *storage) {
return storage->Create<ListMapIndexingOperator>();
}
@ -656,7 +656,7 @@ void Aggregation::Save(capnp::BinaryOperator::Builder *builder,
}
Aggregation *Aggregation::Construct(const capnp::Aggregation::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
Op op;
switch (reader.getOp()) {
case capnp::Aggregation::Op::AVG:
@ -701,7 +701,7 @@ void UnaryOperator::Save(capnp::UnaryOperator::Builder *builder,
}
void UnaryOperator::Load(const capnp::Tree::Reader &reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
Expression::Load(reader, storage, loaded_uids);
if (reader.hasExpression()) {
@ -713,7 +713,7 @@ void UnaryOperator::Load(const capnp::Tree::Reader &reader,
}
UnaryOperator *UnaryOperator::Construct(
const capnp::UnaryOperator::Reader &reader, AstTreeStorage *storage) {
const capnp::UnaryOperator::Reader &reader, AstStorage *storage) {
switch (reader.which()) {
case capnp::UnaryOperator::IS_NULL_OPERATOR: {
auto op = reader.getIsNullOperator();
@ -742,7 +742,7 @@ void IsNullOperator::Save(capnp::UnaryOperator::Builder *builder,
}
IsNullOperator *IsNullOperator::Construct(const capnp::IsNullOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<IsNullOperator>();
}
@ -754,7 +754,7 @@ void NotOperator::Save(capnp::UnaryOperator::Builder *builder,
}
NotOperator *NotOperator::Construct(const capnp::NotOperator::Reader &,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<NotOperator>();
}
@ -766,7 +766,7 @@ void UnaryPlusOperator::Save(capnp::UnaryOperator::Builder *builder,
}
UnaryPlusOperator *UnaryPlusOperator::Construct(
const capnp::UnaryPlusOperator::Reader &, AstTreeStorage *storage) {
const capnp::UnaryPlusOperator::Reader &, AstStorage *storage) {
return storage->Create<UnaryPlusOperator>();
}
@ -778,7 +778,7 @@ void UnaryMinusOperator::Save(capnp::UnaryOperator::Builder *builder,
}
UnaryMinusOperator *UnaryMinusOperator::Construct(
capnp::UnaryMinusOperator::Reader &, AstTreeStorage *storage) {
capnp::UnaryMinusOperator::Reader &, AstStorage *storage) {
return storage->Create<UnaryMinusOperator>();
}
@ -807,7 +807,7 @@ void ListSlicingOperator::Save(capnp::ListSlicingOperator::Builder *builder,
}
void ListSlicingOperator::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
Expression::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getListSlicingOperator();
@ -828,7 +828,7 @@ void ListSlicingOperator::Load(const capnp::Tree::Reader &base_reader,
}
ListSlicingOperator *ListSlicingOperator::Construct(
const capnp::ListSlicingOperator::Reader &reader, AstTreeStorage *storage) {
const capnp::ListSlicingOperator::Reader &reader, AstStorage *storage) {
return storage->Create<ListSlicingOperator>(nullptr, nullptr, nullptr);
}
@ -851,7 +851,7 @@ void IfOperator::Save(capnp::IfOperator::Builder *builder,
}
void IfOperator::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Expression::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getIfOperator();
const auto condition_reader = reader.getCondition();
@ -866,7 +866,7 @@ void IfOperator::Load(const capnp::Tree::Reader &base_reader,
}
IfOperator *IfOperator::Construct(const capnp::IfOperator::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<IfOperator>(nullptr, nullptr, nullptr);
}
@ -887,7 +887,7 @@ void All::Save(capnp::All::Builder *builder, std::vector<int> *saved_uids) {
where_->Save(&where_builder, saved_uids);
}
void All::Load(const capnp::Tree::Reader &base_reader, AstTreeStorage *storage,
void All::Load(const capnp::Tree::Reader &base_reader, AstStorage *storage,
std::vector<int> *loaded_uids) {
Expression::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getAll();
@ -901,7 +901,7 @@ void All::Load(const capnp::Tree::Reader &base_reader, AstTreeStorage *storage,
where_ = dynamic_cast<Where *>(storage->Load(where_reader, loaded_uids));
}
All *All::Construct(const capnp::All::Reader &reader, AstTreeStorage *storage) {
All *All::Construct(const capnp::All::Reader &reader, AstStorage *storage) {
return storage->Create<All>(nullptr, nullptr, nullptr);
}
@ -925,7 +925,7 @@ void Function::Save(capnp::Function::Builder *builder,
}
void Function::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Expression::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getFunction();
function_name_ = reader.getFunctionName().cStr();
@ -937,7 +937,7 @@ void Function::Load(const capnp::Tree::Reader &base_reader,
}
Function *Function::Construct(const capnp::Function::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Function>();
}
@ -956,7 +956,7 @@ void Identifier::Save(capnp::Identifier::Builder *builder,
}
Identifier *Identifier::Construct(const capnp::Identifier::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
auto name = reader.getName().cStr();
auto user_declared = reader.getUserDeclared();
return storage->Create<Identifier>(name, user_declared);
@ -984,7 +984,7 @@ void LabelsTest::Save(capnp::LabelsTest::Builder *builder,
}
void LabelsTest::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Expression::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getLabelsTest();
if (reader.hasExpression()) {
@ -1000,7 +1000,7 @@ void LabelsTest::Load(const capnp::Tree::Reader &base_reader,
}
LabelsTest *LabelsTest::Construct(const capnp::LabelsTest::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<LabelsTest>(nullptr, std::vector<storage::Label>());
}
@ -1018,7 +1018,7 @@ void ParameterLookup::Save(capnp::ParameterLookup::Builder *builder,
}
ParameterLookup *ParameterLookup::Construct(
const capnp::ParameterLookup::Reader &reader, AstTreeStorage *storage) {
const capnp::ParameterLookup::Reader &reader, AstStorage *storage) {
auto token_position = reader.getTokenPosition();
return storage->Create<ParameterLookup>(token_position);
}
@ -1043,7 +1043,7 @@ void PropertyLookup::Save(capnp::PropertyLookup::Builder *builder,
}
void PropertyLookup::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
Expression::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getPropertyLookup();
@ -1058,7 +1058,7 @@ void PropertyLookup::Load(const capnp::Tree::Reader &base_reader,
}
PropertyLookup *PropertyLookup::Construct(
const capnp::PropertyLookup::Reader &reader, AstTreeStorage *storage) {
const capnp::PropertyLookup::Reader &reader, AstStorage *storage) {
return storage->Create<PropertyLookup>(nullptr, "", storage::Property());
}
@ -1085,7 +1085,7 @@ void Reduce::Save(capnp::Reduce::Builder *builder,
}
void Reduce::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Expression::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getReduce();
const auto acc_reader = reader.getAccumulator();
@ -1105,7 +1105,7 @@ void Reduce::Load(const capnp::Tree::Reader &base_reader,
}
Reduce *Reduce::Construct(const capnp::Reduce::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Reduce>(nullptr, nullptr, nullptr, nullptr, nullptr);
}
@ -1128,7 +1128,7 @@ void Single::Save(capnp::Single::Builder *builder,
}
void Single::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Expression::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getExpression().getSingle();
const auto id_reader = reader.getIdentifier();
@ -1142,7 +1142,7 @@ void Single::Load(const capnp::Tree::Reader &base_reader,
}
Single *Single::Construct(const capnp::Single::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Single>(nullptr, nullptr, nullptr);
}
@ -1166,7 +1166,7 @@ void Where::Save(capnp::Where::Builder *builder, std::vector<int> *saved_uids) {
}
void Where::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Tree::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getWhere();
if (reader.hasExpression()) {
@ -1177,7 +1177,7 @@ void Where::Load(const capnp::Tree::Reader &base_reader,
}
Where *Where::Construct(const capnp::Where::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Where>();
}
@ -1194,7 +1194,7 @@ void Clause::Save(capnp::Tree::Builder *tree_builder,
}
Clause *Clause::Construct(const capnp::Clause::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
switch (reader.which()) {
case capnp::Clause::CREATE: {
auto create_reader = reader.getCreate();
@ -1271,7 +1271,7 @@ void Create::Save(capnp::Create::Builder *builder,
}
void Create::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getCreate();
for (const auto pattern_reader : reader.getPatterns()) {
@ -1281,7 +1281,7 @@ void Create::Load(const capnp::Tree::Reader &base_reader,
}
Create *Create::Construct(const capnp::Create::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Create>();
}
@ -1302,7 +1302,7 @@ void CreateIndex::Save(capnp::CreateIndex::Builder *builder,
}
CreateIndex *CreateIndex::Construct(const capnp::CreateIndex::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
auto label_reader = reader.getLabel();
storage::Label label;
label.Load(label_reader);
@ -1332,7 +1332,7 @@ void Delete::Save(capnp::Delete::Builder *builder,
}
void Delete::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getDelete();
for (const auto tree_reader : reader.getExpressions()) {
@ -1343,7 +1343,7 @@ void Delete::Load(const capnp::Tree::Reader &base_reader,
}
Delete *Delete::Construct(const capnp::Delete::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Delete>();
}
@ -1371,7 +1371,7 @@ void Match::Save(capnp::Match::Builder *builder, std::vector<int> *saved_uids) {
}
void Match::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getMatch();
for (const auto tree_reader : reader.getPatterns()) {
@ -1386,7 +1386,7 @@ void Match::Load(const capnp::Tree::Reader &base_reader,
}
Match *Match::Construct(const capnp::Match::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Match>();
}
@ -1420,7 +1420,7 @@ void Merge::Save(capnp::Merge::Builder *builder, std::vector<int> *saved_uids) {
}
void Merge::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getMerge();
for (const auto tree_reader : reader.getOnMatch()) {
@ -1439,7 +1439,7 @@ void Merge::Load(const capnp::Tree::Reader &base_reader,
}
}
Merge *Merge::Construct(const capnp::Merge::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Merge>();
}
@ -1465,7 +1465,7 @@ void RemoveLabels::Save(capnp::RemoveLabels::Builder *builder,
}
void RemoveLabels::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getRemoveLabels();
@ -1482,7 +1482,7 @@ void RemoveLabels::Load(const capnp::Tree::Reader &base_reader,
}
RemoveLabels *RemoveLabels::Construct(const capnp::RemoveLabels::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<RemoveLabels>();
}
@ -1503,7 +1503,7 @@ void RemoveProperty::Save(capnp::RemoveProperty::Builder *builder,
}
void RemoveProperty::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getRemoveProperty();
@ -1515,7 +1515,7 @@ void RemoveProperty::Load(const capnp::Tree::Reader &base_reader,
}
RemoveProperty *RemoveProperty::Construct(
const capnp::RemoveProperty::Reader &reader, AstTreeStorage *storage) {
const capnp::RemoveProperty::Reader &reader, AstStorage *storage) {
return storage->Create<RemoveProperty>();
}
@ -1568,7 +1568,7 @@ void Return::Save(capnp::Return::Builder *builder,
}
void LoadReturnBody(capnp::ReturnBody::Reader &rb_reader, ReturnBody &body,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
body.distinct = rb_reader.getDistinct();
body.all_identifiers = rb_reader.getAllIdentifiers();
@ -1601,7 +1601,7 @@ void LoadReturnBody(capnp::ReturnBody::Reader &rb_reader, ReturnBody &body,
}
void Return::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getReturn();
auto rb_reader = reader.getReturnBody();
@ -1609,7 +1609,7 @@ void Return::Load(const capnp::Tree::Reader &base_reader,
}
Return *Return::Construct(const capnp::Return::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Return>();
}
@ -1635,7 +1635,7 @@ void SetLabels::Save(capnp::SetLabels::Builder *builder,
}
void SetLabels::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getSetLabels();
if (reader.hasIdentifier()) {
@ -1651,7 +1651,7 @@ void SetLabels::Load(const capnp::Tree::Reader &base_reader,
}
SetLabels *SetLabels::Construct(const capnp::SetLabels::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<SetLabels>();
}
@ -1676,7 +1676,7 @@ void SetProperty::Save(capnp::SetProperty::Builder *builder,
}
void SetProperty::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getSetProperty();
if (reader.hasPropertyLookup()) {
@ -1692,7 +1692,7 @@ void SetProperty::Load(const capnp::Tree::Reader &base_reader,
}
SetProperty *SetProperty::Construct(const capnp::SetProperty::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<SetProperty>();
}
@ -1718,7 +1718,7 @@ void SetProperties::Save(capnp::SetProperties::Builder *builder,
}
void SetProperties::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getSetProperties();
@ -1736,7 +1736,7 @@ void SetProperties::Load(const capnp::Tree::Reader &base_reader,
}
SetProperties *SetProperties::Construct(
const capnp::SetProperties::Reader &reader, AstTreeStorage *storage) {
const capnp::SetProperties::Reader &reader, AstStorage *storage) {
return storage->Create<SetProperties>();
}
@ -1757,7 +1757,7 @@ void Unwind::Save(capnp::Unwind::Builder *builder,
}
void Unwind::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getUnwind();
if (reader.hasNamedExpression()) {
@ -1768,7 +1768,7 @@ void Unwind::Load(const capnp::Tree::Reader &base_reader,
}
Unwind *Unwind::Construct(const capnp::Unwind::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Unwind>();
}
@ -1789,7 +1789,7 @@ void With::Save(capnp::With::Builder *builder, std::vector<int> *saved_uids) {
SaveReturnBody(&rb_builder, body_, saved_uids);
}
void With::Load(const capnp::Tree::Reader &base_reader, AstTreeStorage *storage,
void With::Load(const capnp::Tree::Reader &base_reader, AstStorage *storage,
std::vector<int> *loaded_uids) {
Clause::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getClause().getWith();
@ -1802,7 +1802,7 @@ void With::Load(const capnp::Tree::Reader &base_reader, AstTreeStorage *storage,
}
With *With::Construct(const capnp::With::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<With>();
}
@ -1833,7 +1833,7 @@ void CypherUnion::Save(capnp::CypherUnion::Builder *builder,
}
void CypherUnion::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Tree::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getCypherUnion();
if (reader.hasSingleQuery()) {
@ -1850,7 +1850,7 @@ void CypherUnion::Load(const capnp::Tree::Reader &base_reader,
}
CypherUnion *CypherUnion::Construct(const capnp::CypherUnion::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<CypherUnion>();
}
@ -1877,7 +1877,7 @@ void NamedExpression::Save(capnp::NamedExpression::Builder *builder,
}
void NamedExpression::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage,
AstStorage *storage,
std::vector<int> *loaded_uids) {
Tree::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getNamedExpression();
@ -1891,7 +1891,7 @@ void NamedExpression::Load(const capnp::Tree::Reader &base_reader,
}
NamedExpression *NamedExpression::Construct(
const capnp::NamedExpression::Reader &reader, AstTreeStorage *storage) {
const capnp::NamedExpression::Reader &reader, AstStorage *storage) {
return storage->Create<NamedExpression>();
}
@ -1922,7 +1922,7 @@ void Pattern::Save(capnp::Pattern::Builder *builder,
}
void Pattern::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Tree::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getPattern();
if (reader.hasIdentifier()) {
@ -1937,7 +1937,7 @@ void Pattern::Load(const capnp::Tree::Reader &base_reader,
}
Pattern *Pattern::Construct(const capnp::Pattern::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<Pattern>();
}
@ -1962,7 +1962,7 @@ void PatternAtom::Save(capnp::PatternAtom::Builder *builder,
}
PatternAtom *PatternAtom::Construct(const capnp::PatternAtom::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
switch (reader.which()) {
case capnp::PatternAtom::EDGE_ATOM: {
auto edge_reader = reader.getEdgeAtom();
@ -1976,7 +1976,7 @@ PatternAtom *PatternAtom::Construct(const capnp::PatternAtom::Reader &reader,
}
void PatternAtom::Load(const capnp::Tree::Reader &reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Tree::Load(reader, storage, loaded_uids);
auto pa_reader = reader.getPatternAtom();
if (pa_reader.hasIdentifier()) {
@ -2017,7 +2017,7 @@ void NodeAtom::Save(capnp::NodeAtom::Builder *builder,
}
void NodeAtom::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
PatternAtom::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getPatternAtom().getNodeAtom();
for (auto entry_reader : reader.getProperties()) {
@ -2040,7 +2040,7 @@ void NodeAtom::Load(const capnp::Tree::Reader &base_reader,
}
NodeAtom *NodeAtom::Construct(const capnp::NodeAtom::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<NodeAtom>();
}
@ -2139,7 +2139,7 @@ void EdgeAtom::Save(capnp::EdgeAtom::Builder *builder,
}
void LoadLambda(capnp::EdgeAtom::Lambda::Reader &reader,
query::EdgeAtom::Lambda &lambda, AstTreeStorage *storage,
query::EdgeAtom::Lambda &lambda, AstStorage *storage,
std::vector<int> *loaded_uids) {
if (reader.hasInnerEdge()) {
const auto ie_reader = reader.getInnerEdge();
@ -2159,7 +2159,7 @@ void LoadLambda(capnp::EdgeAtom::Lambda::Reader &reader,
}
void EdgeAtom::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
PatternAtom::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getPatternAtom().getEdgeAtom();
switch (reader.getType()) {
@ -2230,7 +2230,7 @@ void EdgeAtom::Load(const capnp::Tree::Reader &base_reader,
}
EdgeAtom *EdgeAtom::Construct(const capnp::EdgeAtom::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<EdgeAtom>();
}
@ -2259,7 +2259,7 @@ void Query::Save(capnp::Query::Builder *builder, std::vector<int> *saved_uids) {
}
}
void Query::Load(const capnp::Tree::Reader &reader, AstTreeStorage *storage,
void Query::Load(const capnp::Tree::Reader &reader, AstStorage *storage,
std::vector<int> *loaded_uids) {
Tree::Load(reader, storage, loaded_uids);
auto query_reader = reader.getQuery();
@ -2297,7 +2297,7 @@ void SingleQuery::Save(capnp::SingleQuery::Builder *builder,
}
void SingleQuery::Load(const capnp::Tree::Reader &base_reader,
AstTreeStorage *storage, std::vector<int> *loaded_uids) {
AstStorage *storage, std::vector<int> *loaded_uids) {
Tree::Load(base_reader, storage, loaded_uids);
auto reader = base_reader.getSingleQuery();
for (const auto tree_reader : reader.getClauses()) {
@ -2307,7 +2307,7 @@ void SingleQuery::Load(const capnp::Tree::Reader &base_reader,
}
SingleQuery *SingleQuery::Construct(const capnp::SingleQuery::Reader &reader,
AstTreeStorage *storage) {
AstStorage *storage) {
return storage->Create<SingleQuery>();
}
} // namespace query

File diff suppressed because it is too large Load Diff

View File

@ -573,7 +573,7 @@ class CypherMainVisitor : public antlropencypher::CypherBaseVisitor {
public:
Query *query() { return query_; }
AstTreeStorage &storage() { return storage_; }
AstStorage &storage() { return storage_; }
const static std::string kAnonPrefix;
private:
@ -582,7 +582,7 @@ class CypherMainVisitor : public antlropencypher::CypherBaseVisitor {
std::unordered_set<std::string> users_identifiers;
// Identifiers that user didn't name.
std::vector<Identifier **> anonymous_identifiers;
AstTreeStorage storage_;
AstStorage storage_;
Query *query_ = nullptr;
// All return items which are not variables must be aliased in with.
// We use this variable in visitReturnItem to check if we are in with or

View File

@ -125,7 +125,7 @@ Interpreter::Results Interpreter::operator()(
std::shared_ptr<Interpreter::CachedPlan> Interpreter::QueryToPlan(
const StrippedQuery &stripped, Context &ctx) {
AstTreeStorage ast_storage = QueryToAst(stripped, ctx);
AstStorage ast_storage = QueryToAst(stripped, ctx);
SymbolGenerator symbol_generator(ctx.symbol_table_);
ast_storage.query()->Accept(symbol_generator);
@ -156,7 +156,7 @@ std::shared_ptr<Interpreter::CachedPlan> Interpreter::QueryToPlan(
}
}
AstTreeStorage Interpreter::QueryToAst(const StrippedQuery &stripped,
AstStorage Interpreter::QueryToAst(const StrippedQuery &stripped,
Context &ctx) {
if (!ctx.is_query_cached_) {
// stripped query -> AST
@ -201,13 +201,13 @@ AstTreeStorage Interpreter::QueryToAst(const StrippedQuery &stripped,
ast_cache_accessor.insert(stripped.hash(), std::move(visitor.storage()))
.first;
}
AstTreeStorage new_ast;
AstStorage new_ast;
ast_it->second.query()->Clone(new_ast);
return new_ast;
}
std::pair<std::unique_ptr<plan::LogicalOperator>, double>
Interpreter::MakeLogicalPlan(AstTreeStorage &ast_storage, Context &context) {
Interpreter::MakeLogicalPlan(AstStorage &ast_storage, Context &context) {
std::unique_ptr<plan::LogicalOperator> logical_plan;
auto vertex_counts = plan::MakeVertexCountCache(context.db_accessor_);
auto planning_context = plan::MakePlanningContext(

View File

@ -164,7 +164,7 @@ class Interpreter {
bool in_explicit_transaction);
private:
ConcurrentMap<HashType, AstTreeStorage> ast_cache_;
ConcurrentMap<HashType, AstStorage> ast_cache_;
PlanCacheT plan_cache_;
std::atomic<int64_t> next_plan_id_{0};
// Antlr has singleton instance that is shared between threads. It is
@ -182,12 +182,12 @@ class Interpreter {
std::shared_ptr<CachedPlan> QueryToPlan(const StrippedQuery &stripped,
Context &ctx);
// stripped query -> high level tree
AstTreeStorage QueryToAst(const StrippedQuery &stripped, Context &ctx);
AstStorage QueryToAst(const StrippedQuery &stripped, Context &ctx);
// high level tree -> (logical plan, plan cost)
// AstTreeStorage and SymbolTable may be modified during planning.
// AstStorage and SymbolTable may be modified during planning.
std::pair<std::unique_ptr<plan::LogicalOperator>, double> MakeLogicalPlan(
AstTreeStorage &, Context &);
AstStorage &, Context &);
};
} // namespace query

View File

@ -16,7 +16,7 @@ namespace query::plan {
namespace {
std::pair<std::unique_ptr<LogicalOperator>, AstTreeStorage> Clone(
std::pair<std::unique_ptr<LogicalOperator>, AstStorage> Clone(
const LogicalOperator &original_plan) {
// TODO: Add a proper Clone method to LogicalOperator
std::stringstream stream;
@ -28,8 +28,8 @@ std::pair<std::unique_ptr<LogicalOperator>, AstTreeStorage> Clone(
LogicalOperator *plan_copy = nullptr;
in_archive >> plan_copy;
return {std::unique_ptr<LogicalOperator>(plan_copy),
std::move(in_archive.template get_helper<AstTreeStorage>(
AstTreeStorage::kHelperId))};
std::move(in_archive.template get_helper<AstStorage>(
AstStorage::kHelperId))};
}
int64_t AddWorkerPlan(DistributedPlan &distributed_plan,

View File

@ -17,7 +17,7 @@ struct DistributedPlan {
std::vector<std::pair<int64_t, std::shared_ptr<LogicalOperator>>>
worker_plans;
/// Ast storage with newly added expressions.
AstTreeStorage ast_storage;
AstStorage ast_storage;
/// Symbol table with newly added symbols.
SymbolTable symbol_table;
};

View File

@ -226,7 +226,7 @@ can serve as inputs to others and thus a sequence of operations is formed.")
};
struct LoadHelper {
AstTreeStorage ast_storage;
AstStorage ast_storage;
std::vector<int> loaded_ast_uids;
std::vector<std::pair<uint64_t, std::shared_ptr<LogicalOperator>>>
loaded_ops;
@ -245,12 +245,12 @@ can serve as inputs to others and thus a sequence of operations is formed.")
#>cpp
template <class TArchive>
std::pair<std::unique_ptr<LogicalOperator>, AstTreeStorage> LoadPlan(
std::pair<std::unique_ptr<LogicalOperator>, AstStorage> LoadPlan(
TArchive &ar) {
std::unique_ptr<LogicalOperator> root;
ar >> root;
return {std::move(root), std::move(ar.template get_helper<AstTreeStorage>(
AstTreeStorage::kHelperId))};
return {std::move(root), std::move(ar.template get_helper<AstStorage>(
AstStorage::kHelperId))};
}
cpp<#

View File

@ -14,7 +14,7 @@
namespace query {
class AstTreeStorage;
class AstStorage;
class SymbolTable;
namespace plan {

View File

@ -82,7 +82,7 @@ std::vector<Expansion> NormalizePatterns(
// will lift them out of a pattern and generate new expressions (just like they
// were in a Where clause).
void AddMatching(const std::vector<Pattern *> &patterns, Where *where,
SymbolTable &symbol_table, AstTreeStorage &storage,
SymbolTable &symbol_table, AstStorage &storage,
Matching &matching) {
auto expansions = NormalizePatterns(symbol_table, patterns);
std::unordered_set<Symbol> edge_symbols;
@ -125,7 +125,7 @@ void AddMatching(const std::vector<Pattern *> &patterns, Where *where,
}
}
void AddMatching(const Match &match, SymbolTable &symbol_table,
AstTreeStorage &storage, Matching &matching) {
AstStorage &storage, Matching &matching) {
return AddMatching(match.patterns_, match.where_, symbol_table, storage,
matching);
}
@ -219,7 +219,7 @@ void Filters::EraseLabelFilter(const Symbol &symbol, storage::Label label) {
}
void Filters::CollectPatternFilters(Pattern &pattern, SymbolTable &symbol_table,
AstTreeStorage &storage) {
AstStorage &storage) {
UsedSymbolsCollector collector(symbol_table);
auto add_properties_variable = [&](EdgeAtom *atom) {
const auto &symbol = symbol_table.at(*atom->identifier_);
@ -443,7 +443,7 @@ void Filters::AnalyzeAndStoreFilter(Expression *expr,
// Converts a Query to multiple QueryParts. In the process new Ast nodes may be
// created, e.g. filter expressions.
std::vector<SingleQueryPart> CollectSingleQueryParts(
SymbolTable &symbol_table, AstTreeStorage &storage,
SymbolTable &symbol_table, AstStorage &storage,
SingleQuery *single_query) {
std::vector<SingleQueryPart> query_parts(1);
auto *query_part = &query_parts.back();
@ -478,7 +478,7 @@ std::vector<SingleQueryPart> CollectSingleQueryParts(
}
QueryParts CollectQueryParts(SymbolTable &symbol_table,
AstTreeStorage &storage) {
AstStorage &storage) {
auto query = storage.query();
std::vector<QueryPart> query_parts;
bool distinct = false;

View File

@ -182,7 +182,7 @@ class Filters {
/// Goes through all the atoms in a pattern and generates filter expressions
/// for found labels, properties and edge types. The generated expressions are
/// stored.
void CollectPatternFilters(Pattern &, SymbolTable &, AstTreeStorage &);
void CollectPatternFilters(Pattern &, SymbolTable &, AstStorage &);
/// Collects filtering information from a where expression.
///
/// Takes the where expression and stores it, then analyzes the expression for
@ -280,8 +280,8 @@ struct QueryParts {
///
/// This function will normalize patterns inside @c Match and @c Merge clauses
/// and do some other preprocessing in order to generate multiple @c QueryPart
/// structures. @c AstTreeStorage and @c SymbolTable may be used to create new
/// structures. @c AstStorage and @c SymbolTable may be used to create new
/// AST nodes.
QueryParts CollectQueryParts(SymbolTable &, AstTreeStorage &);
QueryParts CollectQueryParts(SymbolTable &, AstStorage &);
} // namespace query::plan

View File

@ -98,7 +98,7 @@ class ReturnBodyContext : public HierarchicalTreeVisitor {
public:
ReturnBodyContext(const ReturnBody &body, SymbolTable &symbol_table,
const std::unordered_set<Symbol> &bound_symbols,
AstTreeStorage &storage, Where *where = nullptr)
AstStorage &storage, Where *where = nullptr)
: body_(body),
symbol_table_(symbol_table),
bound_symbols_(bound_symbols),
@ -449,7 +449,7 @@ class ReturnBodyContext : public HierarchicalTreeVisitor {
const ReturnBody &body_;
SymbolTable &symbol_table_;
const std::unordered_set<Symbol> &bound_symbols_;
AstTreeStorage &storage_;
AstStorage &storage_;
const Where *const where_ = nullptr;
std::unordered_set<Symbol> used_symbols_;
std::vector<Symbol> output_symbols_;
@ -523,7 +523,7 @@ std::unique_ptr<LogicalOperator> GenReturnBody(
namespace impl {
Expression *ExtractFilters(const std::unordered_set<Symbol> &bound_symbols,
Filters &filters, AstTreeStorage &storage) {
Filters &filters, AstStorage &storage) {
Expression *filter_expr = nullptr;
for (auto filters_it = filters.begin(); filters_it != filters.end();) {
if (HasBoundFilterSymbols(bound_symbols, *filters_it)) {
@ -540,7 +540,7 @@ Expression *ExtractFilters(const std::unordered_set<Symbol> &bound_symbols,
std::unique_ptr<LogicalOperator> GenFilters(
std::unique_ptr<LogicalOperator> last_op,
const std::unordered_set<Symbol> &bound_symbols, Filters &filters,
AstTreeStorage &storage) {
AstStorage &storage) {
auto *filter_expr = ExtractFilters(bound_symbols, filters, storage);
if (filter_expr) {
last_op = std::make_unique<Filter>(std::move(last_op), filter_expr);
@ -576,7 +576,7 @@ std::unique_ptr<LogicalOperator> GenNamedPaths(
std::unique_ptr<LogicalOperator> GenReturn(
Return &ret, std::unique_ptr<LogicalOperator> input_op,
SymbolTable &symbol_table, bool is_write,
const std::unordered_set<Symbol> &bound_symbols, AstTreeStorage &storage) {
const std::unordered_set<Symbol> &bound_symbols, AstStorage &storage) {
// Similar to WITH clause, but we want to accumulate when the query writes to
// the database. This way we handle the case when we want to return
// expressions with the latest updated results. For example, `MATCH (n) -- ()
@ -672,7 +672,7 @@ std::unique_ptr<LogicalOperator> HandleWriteClause(
std::unique_ptr<LogicalOperator> GenWith(
With &with, std::unique_ptr<LogicalOperator> input_op,
SymbolTable &symbol_table, bool is_write,
std::unordered_set<Symbol> &bound_symbols, AstTreeStorage &storage) {
std::unordered_set<Symbol> &bound_symbols, AstStorage &storage) {
// WITH clause is Accumulate/Aggregate (advance_command) + Produce and
// optional Filter. In case of update and aggregation, we want to accumulate
// first, so that when aggregating, we get the latest results. Similar to

View File

@ -23,7 +23,7 @@ struct PlanningContext {
SymbolTable &symbol_table;
/// @brief The storage is used to traverse the AST as well as create new nodes
/// for use in operators.
AstTreeStorage &ast_storage;
AstStorage &ast_storage;
/// @brief TDbAccessor, which may be used to get some information from the
/// database to generate better plans. The accessor is required only to live
/// long enough for the plan generation to finish.
@ -38,7 +38,7 @@ struct PlanningContext {
};
template <class TDbAccessor>
auto MakePlanningContext(AstTreeStorage &ast_storage, SymbolTable &symbol_table,
auto MakePlanningContext(AstStorage &ast_storage, SymbolTable &symbol_table,
const TDbAccessor &db) {
return PlanningContext<TDbAccessor>{symbol_table, ast_storage, db};
}
@ -67,11 +67,11 @@ namespace impl {
// `AndOperator` if symbols they use are bound.. All the joined filters are
// removed from `Filters`.
Expression *ExtractFilters(const std::unordered_set<Symbol> &, Filters &,
AstTreeStorage &);
AstStorage &);
std::unique_ptr<LogicalOperator> GenFilters(std::unique_ptr<LogicalOperator>,
const std::unordered_set<Symbol> &,
Filters &, AstTreeStorage &);
Filters &, AstStorage &);
// For all given `named_paths` checks if all its symbols have been bound.
// If so, it creates a logical operator for named path generation, binds its
@ -85,7 +85,7 @@ std::unique_ptr<LogicalOperator> GenNamedPaths(
std::unique_ptr<LogicalOperator> GenReturn(
Return &ret, std::unique_ptr<LogicalOperator> input_op,
SymbolTable &symbol_table, bool is_write,
const std::unordered_set<Symbol> &bound_symbols, AstTreeStorage &storage);
const std::unordered_set<Symbol> &bound_symbols, AstStorage &storage);
std::unique_ptr<LogicalOperator> GenCreateForPattern(
Pattern &pattern, std::unique_ptr<LogicalOperator> input_op,
@ -98,14 +98,14 @@ std::unique_ptr<LogicalOperator> HandleWriteClause(
std::unique_ptr<LogicalOperator> GenWith(
With &with, std::unique_ptr<LogicalOperator> input_op,
SymbolTable &symbol_table, bool is_write,
std::unordered_set<Symbol> &bound_symbols, AstTreeStorage &storage);
std::unordered_set<Symbol> &bound_symbols, AstStorage &storage);
std::unique_ptr<LogicalOperator> GenUnion(
CypherUnion &cypher_union, std::shared_ptr<LogicalOperator> left_op,
std::shared_ptr<LogicalOperator> right_op, SymbolTable &symbol_table);
template <class TBoolOperator>
Expression *BoolJoin(AstTreeStorage &storage, Expression *expr1,
Expression *BoolJoin(AstStorage &storage, Expression *expr1,
Expression *expr2) {
if (expr1 && expr2) {
return storage.Create<TBoolOperator>(expr1, expr2);

View File

@ -9,7 +9,7 @@
#include "query/plan/vertex_count_cache.hpp"
// Add chained MATCH (node1) -- (node2), MATCH (node2) -- (node3) ... clauses.
static void AddChainedMatches(int num_matches, query::AstTreeStorage &storage) {
static void AddChainedMatches(int num_matches, query::AstStorage &storage) {
for (int i = 0; i < num_matches; ++i) {
auto *match = storage.Create<query::Match>();
auto *pattern = storage.Create<query::Pattern>();
@ -34,7 +34,7 @@ static void BM_PlanChainedMatches(benchmark::State &state) {
database::GraphDbAccessor dba(db);
while (state.KeepRunning()) {
state.PauseTiming();
query::AstTreeStorage storage;
query::AstStorage storage;
int num_matches = state.range(0);
AddChainedMatches(num_matches, storage);
query::SymbolTable symbol_table;
@ -64,7 +64,7 @@ BENCHMARK(BM_PlanChainedMatches)
static void AddIndexedMatches(
int num_matches, storage::Label label,
const std::pair<std::string, storage::Property> &property,
query::AstTreeStorage &storage) {
query::AstStorage &storage) {
for (int i = 0; i < num_matches; ++i) {
auto *match = storage.Create<query::Match>();
auto *pattern = storage.Create<query::Pattern>();
@ -110,7 +110,7 @@ static void BM_PlanAndEstimateIndexedMatching(benchmark::State &state) {
Parameters parameters;
while (state.KeepRunning()) {
state.PauseTiming();
query::AstTreeStorage storage;
query::AstStorage storage;
AddIndexedMatches(index_count, label, std::make_pair("prop", prop),
storage);
query::SymbolTable symbol_table;
@ -144,7 +144,7 @@ static void BM_PlanAndEstimateIndexedMatchingWithCachedCounts(
Parameters parameters;
while (state.KeepRunning()) {
state.PauseTiming();
query::AstTreeStorage storage;
query::AstStorage storage;
AddIndexedMatches(index_count, label, std::make_pair("prop", prop),
storage);
query::SymbolTable symbol_table;

View File

@ -725,7 +725,7 @@ void ExaminePlans(
}
}
query::AstTreeStorage MakeAst(const std::string &query,
query::AstStorage MakeAst(const std::string &query,
database::GraphDbAccessor &dba) {
query::Context ctx(dba);
// query -> AST
@ -736,7 +736,7 @@ query::AstTreeStorage MakeAst(const std::string &query,
return std::move(visitor.storage());
}
query::SymbolTable MakeSymbolTable(const query::AstTreeStorage &ast) {
query::SymbolTable MakeSymbolTable(const query::AstStorage &ast) {
query::SymbolTable symbol_table;
query::SymbolGenerator symbol_generator(symbol_table);
ast.query()->Accept(symbol_generator);
@ -745,7 +745,7 @@ query::SymbolTable MakeSymbolTable(const query::AstTreeStorage &ast) {
// Returns a list of pairs (plan, estimated cost), sorted in the ascending
// order by cost.
auto MakeLogicalPlans(query::AstTreeStorage &ast,
auto MakeLogicalPlans(query::AstStorage &ast,
query::SymbolTable &symbol_table,
InteractiveDbAccessor &dba) {
auto query_parts = query::plan::CollectQueryParts(symbol_table, ast);

View File

@ -68,7 +68,7 @@ class OriginalAfterCloningAstGenerator : public AstGenerator {
public:
explicit OriginalAfterCloningAstGenerator(const std::string &query)
: AstGenerator(query) {
AstTreeStorage storage;
AstStorage storage;
visitor_.query()->Clone(storage);
}
};
@ -86,7 +86,7 @@ class ClonedAstGenerator : public Base {
return visitor.query()->Clone(storage);
}()) {}
AstTreeStorage storage;
AstStorage storage;
Query *query_;
};
@ -103,13 +103,13 @@ class CachedAstGenerator : public Base {
::frontend::opencypher::Parser parser(stripped.query());
CypherMainVisitor visitor(context_);
visitor.visit(parser.tree());
AstTreeStorage new_ast;
AstStorage new_ast;
visitor.storage().query()->Clone(new_ast);
return new_ast;
}()),
query_(storage_.query()) {}
AstTreeStorage storage_;
AstStorage storage_;
Query *query_;
};
@ -127,7 +127,7 @@ class SerializedAstGenerator : public Base {
boost::archive::binary_oarchive out_archive(stream);
out_archive << *visitor.query();
}
AstTreeStorage new_ast;
AstStorage new_ast;
{
boost::archive::binary_iarchive in_archive(stream);
new_ast.Load(in_archive);
@ -136,7 +136,7 @@ class SerializedAstGenerator : public Base {
}()),
query_(storage_.query()) {}
AstTreeStorage storage_;
AstStorage storage_;
Query *query_;
};
@ -157,7 +157,7 @@ class CapnpAstGenerator : public Base {
visitor.query()->Save(&builder, &saved_uids);
}
AstTreeStorage new_ast;
AstStorage new_ast;
{
const query::capnp::Tree::Reader reader =
message.getRoot<query::capnp::Tree>();
@ -168,7 +168,7 @@ class CapnpAstGenerator : public Base {
}()),
query_(storage_.query()) {}
AstTreeStorage storage_;
AstStorage storage_;
Query *query_;
};

View File

@ -102,7 +102,7 @@ TEST_F(DistributedGraphDbTest, DispatchPlan) {
auto kRPCWaitTime = 600ms;
int64_t plan_id = 5;
SymbolTable symbol_table;
AstTreeStorage storage;
AstStorage storage;
auto scan_all = MakeScanAll(storage, symbol_table, "n");

View File

@ -35,7 +35,7 @@ TEST_F(DistributedGraphDbTest, PullProduceRpc) {
GraphDbAccessor dba{master()};
Context ctx{dba};
SymbolGenerator symbol_generator{ctx.symbol_table_};
AstTreeStorage storage;
AstStorage storage;
// Query plan for: UNWIND [42, true, "bla", 1, 2] as x RETURN x
using namespace query;
@ -122,7 +122,7 @@ TEST_F(DistributedGraphDbTest, PullProduceRpcWithGraphElements) {
GraphDbAccessor dba{master()};
Context ctx{dba};
SymbolGenerator symbol_generator{ctx.symbol_table_};
AstTreeStorage storage;
AstStorage storage;
// Query plan for: MATCH p = (n)-[r]->(m) return [n, r], m, p
// Use this query to test graph elements are transferred correctly in
@ -202,7 +202,7 @@ TEST_F(DistributedGraphDbTest, Synchronize) {
GraphDbAccessor dba{db};
Context ctx{dba};
SymbolGenerator symbol_generator{ctx.symbol_table_};
AstTreeStorage storage;
AstStorage storage;
// MATCH
auto n = MakeScanAll(storage, ctx.symbol_table_, "n");
auto r_m =
@ -250,7 +250,7 @@ TEST_F(DistributedGraphDbTest, Create) {
GraphDbAccessor dba{db};
Context ctx{dba};
SymbolGenerator symbol_generator{ctx.symbol_table_};
AstTreeStorage storage;
AstStorage storage;
auto range = FN("range", LITERAL(0), LITERAL(1000));
auto x = ctx.symbol_table_.CreateSymbol("x", true);
auto unwind = std::make_shared<plan::Unwind>(nullptr, range, x);
@ -294,7 +294,7 @@ TEST_F(DistributedGraphDbTest, PullRemoteOrderBy) {
GraphDbAccessor dba{db};
Context ctx{dba};
SymbolGenerator symbol_generator{ctx.symbol_table_};
AstTreeStorage storage;
AstStorage storage;
// Query plan for: MATCH (n) RETURN n.prop ORDER BY n.prop;
auto n = MakeScanAll(storage, ctx.symbol_table_, "n");
@ -336,7 +336,7 @@ TEST_F(DistributedTransactionTimeout, Timeout) {
GraphDbAccessor dba{master()};
Context ctx{dba};
SymbolGenerator symbol_generator{ctx.symbol_table_};
AstTreeStorage storage;
AstStorage storage;
// Make distributed plan for MATCH (n) RETURN n
auto scan_all = MakeScanAll(storage, ctx.symbol_table_, "n");

View File

@ -4,7 +4,7 @@
/// The usage of macros is very similar to how one would write openCypher. For
/// example:
///
/// AstTreeStorage storage; // Macros rely on storage being in scope.
/// AstStorage storage; // Macros rely on storage being in scope.
/// // PROPERTY_LOOKUP and PROPERTY_PAIR macros rely on database::SingleNode
/// database::SingleNode db;
///
@ -109,26 +109,26 @@ auto GetOrderBy(T... exprs) {
///
/// Name is used to create the Identifier which is used for property lookup.
///
auto GetPropertyLookup(AstTreeStorage &storage, database::GraphDb &db,
auto GetPropertyLookup(AstStorage &storage, database::GraphDb &db,
const std::string &name, storage::Property property) {
database::GraphDbAccessor dba(db);
return storage.Create<PropertyLookup>(storage.Create<Identifier>(name),
dba.PropertyName(property), property);
}
auto GetPropertyLookup(AstTreeStorage &storage, database::GraphDb &db,
auto GetPropertyLookup(AstStorage &storage, database::GraphDb &db,
Expression *expr, storage::Property property) {
database::GraphDbAccessor dba(db);
return storage.Create<PropertyLookup>(expr, dba.PropertyName(property),
property);
}
auto GetPropertyLookup(
AstTreeStorage &storage, database::GraphDb &, const std::string &name,
AstStorage &storage, database::GraphDb &, const std::string &name,
const std::pair<std::string, storage::Property> &prop_pair) {
return storage.Create<PropertyLookup>(storage.Create<Identifier>(name),
prop_pair.first, prop_pair.second);
}
auto GetPropertyLookup(
AstTreeStorage &storage, database::GraphDb &, Expression *expr,
AstStorage &storage, database::GraphDb &, Expression *expr,
const std::pair<std::string, storage::Property> &prop_pair) {
return storage.Create<PropertyLookup>(expr, prop_pair.first,
prop_pair.second);
@ -139,7 +139,7 @@ auto GetPropertyLookup(
///
/// Name is used to create the Identifier which is assigned to the edge.
///
auto GetEdge(AstTreeStorage &storage, const std::string &name,
auto GetEdge(AstStorage &storage, const std::string &name,
EdgeAtom::Direction dir = EdgeAtom::Direction::BOTH,
const std::vector<storage::EdgeType> &edge_types = {}) {
return storage.Create<EdgeAtom>(storage.Create<Identifier>(name),
@ -152,7 +152,7 @@ auto GetEdge(AstTreeStorage &storage, const std::string &name,
///
/// Name is used to create the Identifier which is assigned to the edge.
///
auto GetEdgeVariable(AstTreeStorage &storage, const std::string &name,
auto GetEdgeVariable(AstStorage &storage, const std::string &name,
EdgeAtom::Direction dir = EdgeAtom::Direction::BOTH,
const std::vector<storage::EdgeType> &edge_types = {},
Identifier *inner_edge = nullptr,
@ -174,7 +174,7 @@ auto GetEdgeVariable(AstTreeStorage &storage, const std::string &name,
///
/// Name is used to create the Identifier which is assigned to the node.
///
auto GetNode(AstTreeStorage &storage, const std::string &name,
auto GetNode(AstStorage &storage, const std::string &name,
std::experimental::optional<storage::Label> label =
std::experimental::nullopt) {
auto node = storage.Create<NodeAtom>(storage.Create<Identifier>(name));
@ -185,7 +185,7 @@ auto GetNode(AstTreeStorage &storage, const std::string &name,
///
/// Create a Pattern with given atoms.
///
auto GetPattern(AstTreeStorage &storage, std::vector<PatternAtom *> atoms) {
auto GetPattern(AstStorage &storage, std::vector<PatternAtom *> atoms) {
auto pattern = storage.Create<Pattern>();
pattern->identifier_ =
storage.Create<Identifier>(utils::RandomString(20), false);
@ -196,7 +196,7 @@ auto GetPattern(AstTreeStorage &storage, std::vector<PatternAtom *> atoms) {
///
/// Create a Pattern with given name and atoms.
///
auto GetPattern(AstTreeStorage &storage, const std::string &name,
auto GetPattern(AstStorage &storage, const std::string &name,
std::vector<PatternAtom *> atoms) {
auto pattern = storage.Create<Pattern>();
pattern->identifier_ = storage.Create<Identifier>(name, true);
@ -261,81 +261,81 @@ auto GetCypherUnion(CypherUnion *cypher_union, SingleQuery *single_query) {
return cypher_union;
}
auto GetQuery(AstTreeStorage &storage, SingleQuery *single_query) {
auto GetQuery(AstStorage &storage, SingleQuery *single_query) {
storage.query()->single_query_ = single_query;
return storage.query();
}
auto GetQuery(AstTreeStorage &storage, SingleQuery *single_query,
auto GetQuery(AstStorage &storage, SingleQuery *single_query,
CypherUnion *cypher_union) {
storage.query()->cypher_unions_.emplace_back(cypher_union);
return GetQuery(storage, single_query);
}
template <class... T>
auto GetQuery(AstTreeStorage &storage, SingleQuery *single_query,
auto GetQuery(AstStorage &storage, SingleQuery *single_query,
CypherUnion *cypher_union, T *... cypher_unions) {
storage.query()->cypher_unions_.emplace_back(cypher_union);
return GetQuery(storage, single_query, cypher_unions...);
}
// Helper functions for constructing RETURN and WITH clauses.
void FillReturnBody(AstTreeStorage &, ReturnBody &body,
void FillReturnBody(AstStorage &, ReturnBody &body,
NamedExpression *named_expr) {
body.named_expressions.emplace_back(named_expr);
}
void FillReturnBody(AstTreeStorage &storage, ReturnBody &body,
void FillReturnBody(AstStorage &storage, ReturnBody &body,
const std::string &name) {
auto *ident = storage.Create<query::Identifier>(name);
auto *named_expr = storage.Create<query::NamedExpression>(name, ident);
body.named_expressions.emplace_back(named_expr);
}
void FillReturnBody(AstTreeStorage &, ReturnBody &body, Limit limit) {
void FillReturnBody(AstStorage &, ReturnBody &body, Limit limit) {
body.limit = limit.expression;
}
void FillReturnBody(AstTreeStorage &, ReturnBody &body, Skip skip,
void FillReturnBody(AstStorage &, ReturnBody &body, Skip skip,
Limit limit = Limit{}) {
body.skip = skip.expression;
body.limit = limit.expression;
}
void FillReturnBody(AstTreeStorage &, ReturnBody &body, OrderBy order_by,
void FillReturnBody(AstStorage &, ReturnBody &body, OrderBy order_by,
Limit limit = Limit{}) {
body.order_by = order_by.expressions;
body.limit = limit.expression;
}
void FillReturnBody(AstTreeStorage &, ReturnBody &body, OrderBy order_by,
void FillReturnBody(AstStorage &, ReturnBody &body, OrderBy order_by,
Skip skip, Limit limit = Limit{}) {
body.order_by = order_by.expressions;
body.skip = skip.expression;
body.limit = limit.expression;
}
void FillReturnBody(AstTreeStorage &, ReturnBody &body, Expression *expr,
void FillReturnBody(AstStorage &, ReturnBody &body, Expression *expr,
NamedExpression *named_expr) {
// This overload supports `RETURN(expr, AS(name))` construct, since
// NamedExpression does not inherit Expression.
named_expr->expression_ = expr;
body.named_expressions.emplace_back(named_expr);
}
void FillReturnBody(AstTreeStorage &storage, ReturnBody &body,
void FillReturnBody(AstStorage &storage, ReturnBody &body,
const std::string &name, NamedExpression *named_expr) {
named_expr->expression_ = storage.Create<query::Identifier>(name);
body.named_expressions.emplace_back(named_expr);
}
template <class... T>
void FillReturnBody(AstTreeStorage &storage, ReturnBody &body, Expression *expr,
void FillReturnBody(AstStorage &storage, ReturnBody &body, Expression *expr,
NamedExpression *named_expr, T... rest) {
named_expr->expression_ = expr;
body.named_expressions.emplace_back(named_expr);
FillReturnBody(storage, body, rest...);
}
template <class... T>
void FillReturnBody(AstTreeStorage &storage, ReturnBody &body,
void FillReturnBody(AstStorage &storage, ReturnBody &body,
NamedExpression *named_expr, T... rest) {
body.named_expressions.emplace_back(named_expr);
FillReturnBody(storage, body, rest...);
}
template <class... T>
void FillReturnBody(AstTreeStorage &storage, ReturnBody &body,
void FillReturnBody(AstStorage &storage, ReturnBody &body,
const std::string &name, NamedExpression *named_expr,
T... rest) {
named_expr->expression_ = storage.Create<query::Identifier>(name);
@ -343,7 +343,7 @@ void FillReturnBody(AstTreeStorage &storage, ReturnBody &body,
FillReturnBody(storage, body, rest...);
}
template <class... T>
void FillReturnBody(AstTreeStorage &storage, ReturnBody &body,
void FillReturnBody(AstStorage &storage, ReturnBody &body,
const std::string &name, T... rest) {
auto *ident = storage.Create<query::Identifier>(name);
auto *named_expr = storage.Create<query::NamedExpression>(name, ident);
@ -366,7 +366,7 @@ void FillReturnBody(AstTreeStorage &storage, ReturnBody &body,
///
/// @sa GetWith
template <class... T>
auto GetReturn(AstTreeStorage &storage, bool distinct, T... exprs) {
auto GetReturn(AstStorage &storage, bool distinct, T... exprs) {
auto ret = storage.Create<Return>();
ret->body_.distinct = distinct;
FillReturnBody(storage, ret->body_, exprs...);
@ -380,7 +380,7 @@ auto GetReturn(AstTreeStorage &storage, bool distinct, T... exprs) {
///
/// @sa GetReturn
template <class... T>
auto GetWith(AstTreeStorage &storage, bool distinct, T... exprs) {
auto GetWith(AstStorage &storage, bool distinct, T... exprs) {
auto with = storage.Create<With>();
with->body_.distinct = distinct;
FillReturnBody(storage, with->body_, exprs...);
@ -390,10 +390,10 @@ auto GetWith(AstTreeStorage &storage, bool distinct, T... exprs) {
///
/// Create the UNWIND clause with given named expression.
///
auto GetUnwind(AstTreeStorage &storage, NamedExpression *named_expr) {
auto GetUnwind(AstStorage &storage, NamedExpression *named_expr) {
return storage.Create<query::Unwind>(named_expr);
}
auto GetUnwind(AstTreeStorage &storage, Expression *expr, NamedExpression *as) {
auto GetUnwind(AstStorage &storage, Expression *expr, NamedExpression *as) {
as->expression_ = expr;
return GetUnwind(storage, as);
}
@ -401,7 +401,7 @@ auto GetUnwind(AstTreeStorage &storage, Expression *expr, NamedExpression *as) {
///
/// Create the delete clause with given named expressions.
///
auto GetDelete(AstTreeStorage &storage, std::vector<Expression *> exprs,
auto GetDelete(AstStorage &storage, std::vector<Expression *> exprs,
bool detach = false) {
auto del = storage.Create<Delete>();
del->expressions_.insert(del->expressions_.begin(), exprs.begin(),
@ -414,7 +414,7 @@ auto GetDelete(AstTreeStorage &storage, std::vector<Expression *> exprs,
/// Create a set property clause for given property lookup and the right hand
/// side expression.
///
auto GetSet(AstTreeStorage &storage, PropertyLookup *prop_lookup,
auto GetSet(AstStorage &storage, PropertyLookup *prop_lookup,
Expression *expr) {
return storage.Create<SetProperty>(prop_lookup, expr);
}
@ -423,7 +423,7 @@ auto GetSet(AstTreeStorage &storage, PropertyLookup *prop_lookup,
/// Create a set properties clause for given identifier name and the right hand
/// side expression.
///
auto GetSet(AstTreeStorage &storage, const std::string &name, Expression *expr,
auto GetSet(AstStorage &storage, const std::string &name, Expression *expr,
bool update = false) {
return storage.Create<SetProperties>(storage.Create<Identifier>(name), expr,
update);
@ -432,7 +432,7 @@ auto GetSet(AstTreeStorage &storage, const std::string &name, Expression *expr,
///
/// Create a set labels clause for given identifier name and labels.
///
auto GetSet(AstTreeStorage &storage, const std::string &name,
auto GetSet(AstStorage &storage, const std::string &name,
std::vector<storage::Label> labels) {
return storage.Create<SetLabels>(storage.Create<Identifier>(name), labels);
}
@ -440,14 +440,14 @@ auto GetSet(AstTreeStorage &storage, const std::string &name,
///
/// Create a remove property clause for given property lookup
///
auto GetRemove(AstTreeStorage &storage, PropertyLookup *prop_lookup) {
auto GetRemove(AstStorage &storage, PropertyLookup *prop_lookup) {
return storage.Create<RemoveProperty>(prop_lookup);
}
///
/// Create a remove labels clause for given identifier name and labels.
///
auto GetRemove(AstTreeStorage &storage, const std::string &name,
auto GetRemove(AstStorage &storage, const std::string &name,
std::vector<storage::Label> labels) {
return storage.Create<RemoveLabels>(storage.Create<Identifier>(name), labels);
}
@ -456,14 +456,14 @@ auto GetRemove(AstTreeStorage &storage, const std::string &name,
/// Create a Merge clause for given Pattern with optional OnMatch and OnCreate
/// parts.
///
auto GetMerge(AstTreeStorage &storage, Pattern *pattern,
auto GetMerge(AstStorage &storage, Pattern *pattern,
OnCreate on_create = OnCreate{}) {
auto *merge = storage.Create<query::Merge>();
merge->pattern_ = pattern;
merge->on_create_ = on_create.set;
return merge;
}
auto GetMerge(AstTreeStorage &storage, Pattern *pattern, OnMatch on_match,
auto GetMerge(AstStorage &storage, Pattern *pattern, OnMatch on_match,
OnCreate on_create = OnCreate{}) {
auto *merge = storage.Create<query::Merge>();
merge->pattern_ = pattern;
@ -478,13 +478,13 @@ auto GetMerge(AstTreeStorage &storage, Pattern *pattern, OnMatch on_match,
///
/// All the following macros implicitly pass `storage` variable to functions.
/// You need to have `AstTreeStorage storage;` somewhere in scope to use them.
/// You need to have `AstStorage storage;` somewhere in scope to use them.
/// Refer to function documentation to see what the macro does.
///
/// Example usage:
///
/// // Create MATCH (n) -[r]- (m) RETURN m AS new_name
/// AstTreeStorage storage;
/// AstStorage storage;
/// auto query = QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m"))),
/// RETURN(NEXPR("new_name"), IDENT("m")));
///

View File

@ -30,7 +30,7 @@ class QueryCostEstimator : public ::testing::Test {
// start it off with Once
std::shared_ptr<LogicalOperator> last_op_ = std::make_shared<Once>();
AstTreeStorage storage_;
AstStorage storage_;
SymbolTable symbol_table_;
Parameters parameters_;
int symbol_count = 0;

View File

@ -44,7 +44,7 @@ struct NoContextExpressionEvaluator {
TypedValue EvaluateFunction(const std::string &function_name,
const std::vector<TypedValue> &args,
database::GraphDb &db) {
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
database::GraphDbAccessor dba(db);
Frame frame{128};
@ -67,7 +67,7 @@ TypedValue EvaluateFunction(const std::string &function_name,
}
TEST(ExpressionEvaluator, OrOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<OrOperator>(storage.Create<PrimitiveLiteral>(true),
@ -81,7 +81,7 @@ TEST(ExpressionEvaluator, OrOperator) {
}
TEST(ExpressionEvaluator, XorOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<XorOperator>(storage.Create<PrimitiveLiteral>(true),
@ -95,7 +95,7 @@ TEST(ExpressionEvaluator, XorOperator) {
}
TEST(ExpressionEvaluator, AndOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<AndOperator>(storage.Create<PrimitiveLiteral>(true),
@ -109,7 +109,7 @@ TEST(ExpressionEvaluator, AndOperator) {
}
TEST(ExpressionEvaluator, AndOperatorShortCircuit) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
{
auto *op =
@ -130,7 +130,7 @@ TEST(ExpressionEvaluator, AndOperatorShortCircuit) {
}
TEST(ExpressionEvaluator, AndOperatorNull) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
{
// Null doesn't short circuit
@ -157,7 +157,7 @@ TEST(ExpressionEvaluator, AndOperatorNull) {
}
TEST(ExpressionEvaluator, AdditionOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op = storage.Create<AdditionOperator>(
storage.Create<PrimitiveLiteral>(2), storage.Create<PrimitiveLiteral>(3));
@ -166,7 +166,7 @@ TEST(ExpressionEvaluator, AdditionOperator) {
}
TEST(ExpressionEvaluator, SubtractionOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op = storage.Create<SubtractionOperator>(
storage.Create<PrimitiveLiteral>(2), storage.Create<PrimitiveLiteral>(3));
@ -175,7 +175,7 @@ TEST(ExpressionEvaluator, SubtractionOperator) {
}
TEST(ExpressionEvaluator, MultiplicationOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op = storage.Create<MultiplicationOperator>(
storage.Create<PrimitiveLiteral>(2), storage.Create<PrimitiveLiteral>(3));
@ -184,7 +184,7 @@ TEST(ExpressionEvaluator, MultiplicationOperator) {
}
TEST(ExpressionEvaluator, DivisionOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<DivisionOperator>(storage.Create<PrimitiveLiteral>(50),
@ -194,7 +194,7 @@ TEST(ExpressionEvaluator, DivisionOperator) {
}
TEST(ExpressionEvaluator, ModOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op = storage.Create<ModOperator>(storage.Create<PrimitiveLiteral>(65),
storage.Create<PrimitiveLiteral>(10));
@ -203,7 +203,7 @@ TEST(ExpressionEvaluator, ModOperator) {
}
TEST(ExpressionEvaluator, EqualOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<EqualOperator>(storage.Create<PrimitiveLiteral>(10),
@ -221,7 +221,7 @@ TEST(ExpressionEvaluator, EqualOperator) {
}
TEST(ExpressionEvaluator, NotEqualOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<NotEqualOperator>(storage.Create<PrimitiveLiteral>(10),
@ -239,7 +239,7 @@ TEST(ExpressionEvaluator, NotEqualOperator) {
}
TEST(ExpressionEvaluator, LessOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op = storage.Create<LessOperator>(storage.Create<PrimitiveLiteral>(10),
storage.Create<PrimitiveLiteral>(15));
@ -256,7 +256,7 @@ TEST(ExpressionEvaluator, LessOperator) {
}
TEST(ExpressionEvaluator, GreaterOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<GreaterOperator>(storage.Create<PrimitiveLiteral>(10),
@ -274,7 +274,7 @@ TEST(ExpressionEvaluator, GreaterOperator) {
}
TEST(ExpressionEvaluator, LessEqualOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<LessEqualOperator>(storage.Create<PrimitiveLiteral>(10),
@ -292,7 +292,7 @@ TEST(ExpressionEvaluator, LessEqualOperator) {
}
TEST(ExpressionEvaluator, GreaterEqualOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op = storage.Create<GreaterEqualOperator>(
storage.Create<PrimitiveLiteral>(10),
@ -312,7 +312,7 @@ TEST(ExpressionEvaluator, GreaterEqualOperator) {
}
TEST(ExpressionEvaluator, InListOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *list_literal = storage.Create<ListLiteral>(std::vector<Expression *>{
storage.Create<PrimitiveLiteral>(1), storage.Create<PrimitiveLiteral>(2),
@ -368,7 +368,7 @@ TEST(ExpressionEvaluator, InListOperator) {
}
TEST(ExpressionEvaluator, ListMapIndexingOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *list_literal = storage.Create<ListLiteral>(std::vector<Expression *>{
storage.Create<PrimitiveLiteral>(1), storage.Create<PrimitiveLiteral>(2),
@ -420,7 +420,7 @@ TEST(ExpressionEvaluator, ListMapIndexingOperator) {
}
TEST(ExpressionEvaluator, MapIndexing) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
database::SingleNode db;
database::GraphDbAccessor dba(db);
@ -460,7 +460,7 @@ TEST(ExpressionEvaluator, MapIndexing) {
}
TEST(ExpressionEvaluator, ListSlicingOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *list_literal = storage.Create<ListLiteral>(std::vector<Expression *>{
storage.Create<PrimitiveLiteral>(1), storage.Create<PrimitiveLiteral>(2),
@ -553,7 +553,7 @@ TEST(ExpressionEvaluator, ListSlicingOperator) {
}
TEST(ExpressionEvaluator, IfOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *then_expression = storage.Create<PrimitiveLiteral>(10);
auto *else_expression = storage.Create<PrimitiveLiteral>(20);
@ -586,7 +586,7 @@ TEST(ExpressionEvaluator, IfOperator) {
}
TEST(ExpressionEvaluator, NotOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<NotOperator>(storage.Create<PrimitiveLiteral>(false));
@ -595,7 +595,7 @@ TEST(ExpressionEvaluator, NotOperator) {
}
TEST(ExpressionEvaluator, UnaryPlusOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<UnaryPlusOperator>(storage.Create<PrimitiveLiteral>(5));
@ -604,7 +604,7 @@ TEST(ExpressionEvaluator, UnaryPlusOperator) {
}
TEST(ExpressionEvaluator, UnaryMinusOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<UnaryMinusOperator>(storage.Create<PrimitiveLiteral>(5));
@ -613,7 +613,7 @@ TEST(ExpressionEvaluator, UnaryMinusOperator) {
}
TEST(ExpressionEvaluator, IsNullOperator) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *op =
storage.Create<IsNullOperator>(storage.Create<PrimitiveLiteral>(1));
@ -627,7 +627,7 @@ TEST(ExpressionEvaluator, IsNullOperator) {
class ExpressionEvaluatorPropertyLookup : public testing::Test {
protected:
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
database::SingleNode db;
database::GraphDbAccessor dba{db};
@ -675,7 +675,7 @@ TEST_F(ExpressionEvaluatorPropertyLookup, MapLiteral) {
}
TEST(ExpressionEvaluator, LabelsTest) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
database::SingleNode db;
database::GraphDbAccessor dba(db);
@ -714,7 +714,7 @@ TEST(ExpressionEvaluator, LabelsTest) {
}
TEST(ExpressionEvaluator, Aggregation) {
AstTreeStorage storage;
AstStorage storage;
auto aggr = storage.Create<Aggregation>(storage.Create<PrimitiveLiteral>(42),
nullptr, Aggregation::Op::COUNT);
SymbolTable symbol_table;
@ -732,7 +732,7 @@ TEST(ExpressionEvaluator, Aggregation) {
}
TEST(ExpressionEvaluator, ListLiteral) {
AstTreeStorage storage;
AstStorage storage;
NoContextExpressionEvaluator eval;
auto *list_literal = storage.Create<ListLiteral>(
std::vector<Expression *>{storage.Create<PrimitiveLiteral>(1),
@ -1196,7 +1196,7 @@ TEST(ExpressionEvaluator, FunctionContains) {
}
TEST(ExpressionEvaluator, FunctionAll) {
AstTreeStorage storage;
AstStorage storage;
auto *ident_x = IDENT("x");
auto *all =
ALL("x", LIST(LITERAL(1), LITERAL(2)), WHERE(EQ(ident_x, LITERAL(1))));
@ -1210,7 +1210,7 @@ TEST(ExpressionEvaluator, FunctionAll) {
}
TEST(ExpressionEvaluator, FunctionAllNullList) {
AstTreeStorage storage;
AstStorage storage;
auto *all = ALL("x", LITERAL(TypedValue::Null), WHERE(LITERAL(true)));
NoContextExpressionEvaluator eval;
const auto x_sym = eval.symbol_table.CreateSymbol("x", true);
@ -1220,7 +1220,7 @@ TEST(ExpressionEvaluator, FunctionAllNullList) {
}
TEST(ExpressionEvaluator, FunctionAllWhereWrongType) {
AstTreeStorage storage;
AstStorage storage;
auto *all = ALL("x", LIST(LITERAL(1)), WHERE(LITERAL(2)));
NoContextExpressionEvaluator eval;
const auto x_sym = eval.symbol_table.CreateSymbol("x", true);
@ -1229,7 +1229,7 @@ TEST(ExpressionEvaluator, FunctionAllWhereWrongType) {
}
TEST(ExpressionEvaluator, FunctionSingle) {
AstTreeStorage storage;
AstStorage storage;
auto *ident_x = IDENT("x");
auto *single =
SINGLE("x", LIST(LITERAL(1), LITERAL(2)), WHERE(EQ(ident_x, LITERAL(1))));
@ -1243,7 +1243,7 @@ TEST(ExpressionEvaluator, FunctionSingle) {
}
TEST(ExpressionEvaluator, FunctionSingle2) {
AstTreeStorage storage;
AstStorage storage;
auto *ident_x = IDENT("x");
auto *single = SINGLE("x", LIST(LITERAL(1), LITERAL(2)),
WHERE(GREATER(ident_x, LITERAL(0))));
@ -1257,7 +1257,7 @@ TEST(ExpressionEvaluator, FunctionSingle2) {
}
TEST(ExpressionEvaluator, FunctionSingleNullList) {
AstTreeStorage storage;
AstStorage storage;
auto *single = SINGLE("x", LITERAL(TypedValue::Null), WHERE(LITERAL(true)));
NoContextExpressionEvaluator eval;
const auto x_sym = eval.symbol_table.CreateSymbol("x", true);
@ -1267,7 +1267,7 @@ TEST(ExpressionEvaluator, FunctionSingleNullList) {
}
TEST(ExpressionEvaluator, FunctionReduce) {
AstTreeStorage storage;
AstStorage storage;
auto *ident_sum = IDENT("sum");
auto *ident_x = IDENT("x");
auto *reduce = REDUCE("sum", LITERAL(0), "x", LIST(LITERAL(1), LITERAL(2)),
@ -1312,7 +1312,7 @@ TEST(ExpressionEvaluator, FunctionAssert) {
TEST(ExpressionEvaluator, ParameterLookup) {
NoContextExpressionEvaluator eval;
eval.parameters.Add(0, 42);
AstTreeStorage storage;
AstStorage storage;
auto *param_lookup = storage.Create<ParameterLookup>(0);
auto value = param_lookup->Accept(eval.eval);
ASSERT_EQ(value.type(), TypedValue::Type::Int);

View File

@ -38,7 +38,7 @@ TEST(QueryPlan, Accumulate) {
dba.InsertEdge(v1, v2, dba.EdgeType("T"));
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -89,7 +89,7 @@ TEST(QueryPlan, AccumulateAdvance) {
auto check = [&](bool advance) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto node = NODE("n");
@ -107,7 +107,7 @@ TEST(QueryPlan, AccumulateAdvance) {
std::shared_ptr<Produce> MakeAggregationProduce(
std::shared_ptr<LogicalOperator> input, SymbolTable &symbol_table,
AstTreeStorage &storage, const std::vector<Expression *> aggr_inputs,
AstStorage &storage, const std::vector<Expression *> aggr_inputs,
const std::vector<Aggregation::Op> aggr_ops,
const std::vector<Expression *> group_by_exprs,
const std::vector<Symbol> remember) {
@ -153,7 +153,7 @@ class QueryPlanAggregateOps : public ::testing::Test {
database::GraphDbAccessor dba{db};
storage::Property prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
void AddData() {
@ -318,7 +318,7 @@ TEST(QueryPlan, AggregateGroupByValues) {
dba.InsertVertex().PropsSet(prop, group_by_vals[i % group_by_vals.size()]);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// match all nodes and perform aggregations
@ -361,7 +361,7 @@ TEST(QueryPlan, AggregateMultipleGroupBy) {
}
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// match all nodes and perform aggregations
@ -384,7 +384,7 @@ TEST(QueryPlan, AggregateMultipleGroupBy) {
TEST(QueryPlan, AggregateNoInput) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto two = LITERAL(2);
@ -413,7 +413,7 @@ TEST(QueryPlan, AggregateCountEdgeCases) {
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -471,7 +471,7 @@ TEST(QueryPlan, AggregateFirstValueTypes) {
v1.PropsSet(prop_int, 12);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -529,7 +529,7 @@ TEST(QueryPlan, AggregateTypes) {
dba.InsertVertex().PropsSet(p2, true);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -576,7 +576,7 @@ TEST(QueryPlan, AggregateTypes) {
TEST(QueryPlan, Unwind) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// UNWIND [ [1, true, "x"], [], ["bla"] ] AS x UNWIND x as y RETURN x, y

View File

@ -25,7 +25,7 @@ TEST(QueryPlan, Skip) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n1");
@ -54,7 +54,7 @@ TEST(QueryPlan, Limit) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n1");
@ -89,7 +89,7 @@ TEST(QueryPlan, CreateLimit) {
dba.InsertVertex();
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n1");
@ -106,7 +106,7 @@ TEST(QueryPlan, CreateLimit) {
TEST(QueryPlan, OrderBy) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto prop = dba.Property("prop");
@ -167,7 +167,7 @@ TEST(QueryPlan, OrderBy) {
TEST(QueryPlan, OrderByMultiple) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto p1 = dba.Property("p1");
@ -223,7 +223,7 @@ TEST(QueryPlan, OrderByMultiple) {
TEST(QueryPlan, OrderByExceptions) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto prop = dba.Property("prop");

View File

@ -92,7 +92,7 @@ struct ScanAllTuple {
*
* Returns ScanAllTuple(node_atom, scan_all_logical_op, symbol).
*/
ScanAllTuple MakeScanAll(AstTreeStorage &storage, SymbolTable &symbol_table,
ScanAllTuple MakeScanAll(AstStorage &storage, SymbolTable &symbol_table,
const std::string &identifier,
std::shared_ptr<LogicalOperator> input = {nullptr},
GraphView graph_view = GraphView::OLD) {
@ -110,7 +110,7 @@ ScanAllTuple MakeScanAll(AstTreeStorage &storage, SymbolTable &symbol_table,
* Returns ScanAllTuple(node_atom, scan_all_logical_op, symbol).
*/
ScanAllTuple MakeScanAllByLabel(
AstTreeStorage &storage, SymbolTable &symbol_table,
AstStorage &storage, SymbolTable &symbol_table,
const std::string &identifier, storage::Label label,
std::shared_ptr<LogicalOperator> input = {nullptr},
GraphView graph_view = GraphView::OLD) {
@ -129,7 +129,7 @@ ScanAllTuple MakeScanAllByLabel(
* Returns ScanAllTuple(node_atom, scan_all_logical_op, symbol).
*/
ScanAllTuple MakeScanAllByLabelPropertyRange(
AstTreeStorage &storage, SymbolTable &symbol_table, std::string identifier,
AstStorage &storage, SymbolTable &symbol_table, std::string identifier,
storage::Label label, storage::Property property,
std::experimental::optional<Bound> lower_bound,
std::experimental::optional<Bound> upper_bound,
@ -150,7 +150,7 @@ ScanAllTuple MakeScanAllByLabelPropertyRange(
* Returns ScanAllTuple(node_atom, scan_all_logical_op, symbol).
*/
ScanAllTuple MakeScanAllByLabelPropertyValue(
AstTreeStorage &storage, SymbolTable &symbol_table, std::string identifier,
AstStorage &storage, SymbolTable &symbol_table, std::string identifier,
storage::Label label, storage::Property property, Expression *value,
std::shared_ptr<LogicalOperator> input = {nullptr},
GraphView graph_view = GraphView::OLD) {
@ -170,7 +170,7 @@ struct ExpandTuple {
std::shared_ptr<LogicalOperator> op_;
};
ExpandTuple MakeExpand(AstTreeStorage &storage, SymbolTable &symbol_table,
ExpandTuple MakeExpand(AstStorage &storage, SymbolTable &symbol_table,
std::shared_ptr<LogicalOperator> input,
Symbol input_symbol, const std::string &edge_identifier,
EdgeAtom::Direction direction,

View File

@ -23,7 +23,7 @@ TEST(QueryPlan, CreateNodeWithAttributes) {
storage::Label label = dba.Label("Person");
auto property = PROPERTY_PAIR("prop");
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto node = NODE("n");
@ -57,7 +57,7 @@ TEST(QueryPlan, CreateReturn) {
storage::Label label = dba.Label("Person");
auto property = PROPERTY_PAIR("property");
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto node = NODE("n");
@ -101,7 +101,7 @@ TEST(QueryPlan, CreateExpand) {
storage::EdgeType edge_type = dba.EdgeType("edge_type");
SymbolTable symbol_table;
AstTreeStorage storage;
AstStorage storage;
auto test_create_path = [&](bool cycle, int expected_nodes_created,
int expected_edges_created) {
@ -176,7 +176,7 @@ TEST(QueryPlan, MatchCreateNode) {
dba.AdvanceCommand();
SymbolTable symbol_table;
AstTreeStorage storage;
AstStorage storage;
// first node
auto n_scan_all = MakeScanAll(storage, symbol_table, "n");
@ -208,7 +208,7 @@ TEST(QueryPlan, MatchCreateExpand) {
storage::EdgeType edge_type = dba.EdgeType("edge_type");
SymbolTable symbol_table;
AstTreeStorage storage;
AstStorage storage;
auto test_create_path = [&](bool cycle, int expected_nodes_created,
int expected_edges_created) {
@ -260,7 +260,7 @@ TEST(QueryPlan, Delete) {
EXPECT_EQ(4, CountIterable(dba.Vertices(false)));
EXPECT_EQ(6, CountIterable(dba.Edges(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// attempt to delete a vertex, and fail
@ -345,7 +345,7 @@ TEST(QueryPlan, DeleteTwiceDeleteBlockingEdge) {
EXPECT_EQ(2, CountIterable(dba.Vertices(false)));
EXPECT_EQ(1, CountIterable(dba.Edges(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -388,7 +388,7 @@ TEST(QueryPlan, DeleteReturn) {
EXPECT_EQ(4, CountIterable(dba.Vertices(false)));
EXPECT_EQ(0, CountIterable(dba.Edges(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -415,7 +415,7 @@ TEST(QueryPlan, DeleteNull) {
// test (simplified) WITH Null as x delete x
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto once = std::make_shared<Once>();
@ -439,7 +439,7 @@ TEST(QueryPlan, DeleteAdvance) {
dba.InsertVertex();
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -468,7 +468,7 @@ TEST(QueryPlan, SetProperty) {
dba.InsertEdge(v2, v4, edge_type);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// scan (n)-[r]->(m)
@ -520,7 +520,7 @@ TEST(QueryPlan, SetProperties) {
v2.PropsSet(prop_c, 2);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// scan (n)-[r]->(m)
@ -585,7 +585,7 @@ TEST(QueryPlan, SetLabels) {
dba.InsertVertex().add_label(label1);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -624,7 +624,7 @@ TEST(QueryPlan, RemoveProperty) {
v2.PropsSet(prop2, 0);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// scan (n)-[r]->(m)
@ -670,7 +670,7 @@ TEST(QueryPlan, RemoveLabels) {
v2.add_label(label3);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -702,7 +702,7 @@ TEST(QueryPlan, NodeFilterSet) {
// Create operations which match (v1 {prop: 42}) -- (v) and increment the
// v1.prop. The expected result is two incremenentations, since v1 is matched
// twice for 2 edges it has.
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// MATCH (n {prop: 42}) -[r]- (m)
auto scan_all = MakeScanAll(storage, symbol_table, "n");
@ -742,7 +742,7 @@ TEST(QueryPlan, FilterRemove) {
dba.AdvanceCommand();
// Create operations which match (v1 {prop: 42}) -- (v) and remove v1.prop.
// The expected result is two matches, for each edge of v1.
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// MATCH (n) -[r]- (m) WHERE n.prop < 43
auto scan_all = MakeScanAll(storage, symbol_table, "n");
@ -773,7 +773,7 @@ TEST(QueryPlan, SetRemove) {
dba.AdvanceCommand();
// Create operations which match (v) and set and remove v :label.
// The expected result is single (v) as it was at the start.
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// MATCH (n) SET n :label1 :label2 REMOVE n :label1 :label2
auto scan_all = MakeScanAll(storage, symbol_table, "n");
@ -803,7 +803,7 @@ TEST(QueryPlan, Merge) {
auto v3 = dba.InsertVertex();
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto prop = PROPERTY_PAIR("property");
@ -843,7 +843,7 @@ TEST(QueryPlan, MergeNoInput) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto node = NODE("n");
@ -862,7 +862,7 @@ TEST(QueryPlan, SetPropertyOnNull) {
// SET (Null).prop = 42
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto prop = PROPERTY_PAIR("property");
auto null = LITERAL(TypedValue::Null);
@ -877,7 +877,7 @@ TEST(QueryPlan, SetPropertiesOnNull) {
// OPTIONAL MATCH (n) SET n = n
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
auto n_ident = IDENT("n");
@ -895,7 +895,7 @@ TEST(QueryPlan, SetLabelsOnNull) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto label = dba.Label("label");
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
auto n_ident = IDENT("n");
@ -912,7 +912,7 @@ TEST(QueryPlan, RemovePropertyOnNull) {
// REMOVE (Null).prop
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto prop = PROPERTY_PAIR("property");
auto null = LITERAL(TypedValue::Null);
@ -927,7 +927,7 @@ TEST(QueryPlan, RemoveLabelsOnNull) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto label = dba.Label("label");
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
auto n_ident = IDENT("n");
@ -960,7 +960,7 @@ TEST(QueryPlan, DeleteSetProperty) {
dba.InsertVertex();
dba.AdvanceCommand();
EXPECT_EQ(1, CountIterable(dba.Vertices(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// MATCH (n) DELETE n SET n.property = 42
auto n = MakeScanAll(storage, symbol_table, "n");
@ -983,7 +983,7 @@ TEST(QueryPlan, DeleteSetPropertiesFromMap) {
dba.InsertVertex();
dba.AdvanceCommand();
EXPECT_EQ(1, CountIterable(dba.Vertices(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// MATCH (n) DELETE n SET n = {property: 42}
auto n = MakeScanAll(storage, symbol_table, "n");
@ -1017,7 +1017,7 @@ TEST(QueryPlan, DeleteSetPropertiesFromVertex) {
}
dba.AdvanceCommand();
EXPECT_EQ(1, CountIterable(dba.Vertices(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// MATCH (n) DELETE n SET n = n
auto n = MakeScanAll(storage, symbol_table, "n");
@ -1045,7 +1045,7 @@ TEST(QueryPlan, DeleteRemoveLabels) {
dba.InsertVertex();
dba.AdvanceCommand();
EXPECT_EQ(1, CountIterable(dba.Vertices(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// MATCH (n) DELETE n REMOVE n :label
auto n = MakeScanAll(storage, symbol_table, "n");
@ -1065,7 +1065,7 @@ TEST(QueryPlan, DeleteRemoveProperty) {
dba.InsertVertex();
dba.AdvanceCommand();
EXPECT_EQ(1, CountIterable(dba.Vertices(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// MATCH (n) DELETE n REMOVE n.property
auto n = MakeScanAll(storage, symbol_table, "n");

View File

@ -29,7 +29,7 @@ class MatchReturnFixture : public testing::Test {
protected:
database::SingleNode db_;
database::GraphDbAccessor dba_{db_};
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
void AddVertices(int count) {
@ -98,7 +98,7 @@ TEST(QueryPlan, MatchReturnCartesian) {
dba.InsertVertex().add_label(dba.Label("l2"));
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -132,7 +132,7 @@ TEST(QueryPlan, StandaloneReturn) {
dba.InsertVertex();
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto output = NEXPR("n", LITERAL(42));
@ -171,7 +171,7 @@ TEST(QueryPlan, NodeFilterLabelsAndProperties) {
v5.PropsSet(property.second, 1);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// make a scan all
@ -226,7 +226,7 @@ TEST(QueryPlan, NodeFilterMultipleLabels) {
v3.add_label(label3);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// make a scan all
@ -265,7 +265,7 @@ TEST(QueryPlan, Cartesian) {
add_vertex("v3")};
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -300,7 +300,7 @@ TEST(QueryPlan, CartesianEmptySet) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -338,7 +338,7 @@ TEST(QueryPlan, CartesianThreeWay) {
add_vertex("v3")};
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -388,7 +388,7 @@ class ExpandFixture : public testing::Test {
protected:
database::SingleNode db_;
database::GraphDbAccessor dba_{db_};
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// make a V-graph (v3)<-[r2]-(v1)-[r1]->(v2)
@ -490,7 +490,7 @@ class QueryPlanExpandVariable : public testing::Test {
// for all the edges
storage::EdgeType edge_type = dba_.EdgeType("edge_type");
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// using std::experimental::nullopt
@ -851,7 +851,7 @@ class QueryPlanExpandBfs
std::vector<storage::VertexAddress> v;
std::unordered_map<std::pair<int, int>, storage::EdgeAddress> e;
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// Inner edge and vertex symbols.
@ -1224,7 +1224,7 @@ class QueryPlanExpandWeightedShortestPath : public testing::Test {
// make some edges too, in a map (from, to) vertex indices
std::unordered_map<std::pair<int, int>, EdgeAccessor> e;
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// inner edge and vertex symbols
@ -1567,7 +1567,7 @@ TEST(QueryPlan, ExpandOptional) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// graph (v2 {p: 2})<-[:T]-(v1 {p: 1})-[:T]->(v3 {p: 2})
@ -1627,7 +1627,7 @@ TEST(QueryPlan, OptionalMatchEmptyDB) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// OPTIONAL MATCH (n)
@ -1648,7 +1648,7 @@ TEST(QueryPlan, OptionalMatchEmptyDB) {
TEST(QueryPlan, OptionalMatchEmptyDBExpandFromNode) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// OPTIONAL MATCH (n)
auto n = MakeScanAll(storage, symbol_table, "n");
@ -1684,7 +1684,7 @@ TEST(QueryPlan, OptionalMatchThenExpandToMissingNode) {
dba.AdvanceCommand();
EXPECT_EQ(2, CountIterable(dba.Vertices(false)));
EXPECT_EQ(1, CountIterable(dba.Edges(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// OPTIONAL MATCH (n :missing)
auto n = MakeScanAll(storage, symbol_table, "n");
@ -1735,7 +1735,7 @@ TEST(QueryPlan, ExpandExistingNode) {
dba.InsertEdge(v1, v2, edge_type);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto test_existing = [&](bool with_existing, int expected_result_count) {
@ -1774,7 +1774,7 @@ TEST(QueryPlan, ExpandBothCycleEdgeCase) {
dba.InsertEdge(v, v, dba.EdgeType("et"));
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -1817,7 +1817,7 @@ TEST(QueryPlan, EdgeFilter) {
for (auto &vertex : vertices) vertex.Reconstruct();
for (auto &edge : edges) edge.Reconstruct();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto test_filter = [&]() {
@ -1867,7 +1867,7 @@ TEST(QueryPlan, EdgeFilterMultipleTypes) {
dba.InsertEdge(v1, v2, type_3);
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// make a scan all
@ -1899,7 +1899,7 @@ TEST(QueryPlan, Filter) {
dba.InsertVertex(); // prop not set, gives NULL
dba.AdvanceCommand();
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n = MakeScanAll(storage, symbol_table, "n");
@ -1931,7 +1931,7 @@ TEST(QueryPlan, ExpandUniquenessFilter) {
auto check_expand_results = [&](bool vertex_uniqueness,
bool edge_uniqueness) {
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto n1 = MakeScanAll(storage, symbol_table, "n1");
@ -1968,7 +1968,7 @@ TEST(QueryPlan, Distinct) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto check_distinct = [&](const std::vector<TypedValue> input,
@ -2019,7 +2019,7 @@ TEST(QueryPlan, ScanAllByLabel) {
dba.AdvanceCommand();
EXPECT_EQ(2, CountIterable(dba.Vertices(false)));
// MATCH (n :label)
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto scan_all_by_label =
MakeScanAllByLabel(storage, symbol_table, "n", label);
@ -2063,7 +2063,7 @@ TEST(QueryPlan, ScanAllByLabelProperty) {
auto check = [&dba, label, prop](TypedValue lower, Bound::Type lower_type,
TypedValue upper, Bound::Type upper_type,
const std::vector<TypedValue> &expected) {
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto scan_all = MakeScanAllByLabelPropertyRange(
storage, symbol_table, "n", label, prop,
@ -2125,7 +2125,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyEqualityNoError) {
database::GraphDbAccessor dba(db);
EXPECT_EQ(2, CountIterable(dba.Vertices(false)));
// MATCH (n :label {prop: 42})
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto scan_all = MakeScanAllByLabelPropertyValue(storage, symbol_table, "n",
label, prop, LITERAL(42));
@ -2161,7 +2161,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyValueError) {
database::GraphDbAccessor dba(db);
EXPECT_EQ(2, CountIterable(dba.Vertices(false)));
// MATCH (m), (n :label {prop: m})
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto scan_all = MakeScanAll(storage, symbol_table, "m");
auto *ident_m = IDENT("m");
@ -2189,7 +2189,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyRangeError) {
database::GraphDbAccessor dba(db);
EXPECT_EQ(2, CountIterable(dba.Vertices(false)));
// MATCH (m), (n :label {prop: m})
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto scan_all = MakeScanAll(storage, symbol_table, "m");
auto *ident_m = IDENT("m");
@ -2242,7 +2242,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyEqualNull) {
database::GraphDbAccessor dba(db);
EXPECT_EQ(2, CountIterable(dba.Vertices(false)));
// MATCH (n :label {prop: 42})
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto scan_all = MakeScanAllByLabelPropertyValue(
storage, symbol_table, "n", label, prop, LITERAL(TypedValue::Null));
@ -2275,7 +2275,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyRangeNull) {
database::GraphDbAccessor dba(db);
EXPECT_EQ(2, CountIterable(dba.Vertices(false)));
// MATCH (n :label) WHERE null <= n.prop < null
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
auto scan_all = MakeScanAllByLabelPropertyRange(
storage, symbol_table, "n", label, prop,
@ -2305,7 +2305,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyNoValueInIndexContinuation) {
database::GraphDbAccessor dba(db);
EXPECT_EQ(1, CountIterable(dba.Vertices(false)));
AstTreeStorage storage;
AstStorage storage;
SymbolTable symbol_table;
// UNWIND [1, 2, 3] as x

View File

@ -30,7 +30,7 @@ namespace query {
} // namespace query
using namespace query::plan;
using query::AstTreeStorage;
using query::AstStorage;
using query::SingleQuery;
using query::Symbol;
using query::SymbolGenerator;
@ -504,7 +504,7 @@ class SerializedPlanner {
auto &plan() { return *plan_; }
private:
AstTreeStorage ast_storage_;
AstStorage ast_storage_;
std::unique_ptr<LogicalOperator> plan_;
};
@ -540,12 +540,12 @@ class CapnpPlanner {
auto &plan() { return *plan_; }
private:
AstTreeStorage ast_storage_;
AstStorage ast_storage_;
std::unique_ptr<LogicalOperator> plan_;
};
template <class TPlanner>
TPlanner MakePlanner(database::MasterBase &master_db, AstTreeStorage &storage,
TPlanner MakePlanner(database::MasterBase &master_db, AstStorage &storage,
SymbolTable &symbol_table) {
database::GraphDbAccessor dba(master_db);
auto planning_context = MakePlanningContext(storage, symbol_table, dba);
@ -564,7 +564,7 @@ auto CheckPlan(LogicalOperator &plan, const SymbolTable &symbol_table,
}
template <class TPlanner, class... TChecker>
auto CheckPlan(AstTreeStorage &storage, TChecker... checker) {
auto CheckPlan(AstStorage &storage, TChecker... checker) {
auto symbol_table = MakeSymbolTable(*storage.query());
database::SingleNode db;
auto planner = MakePlanner<TPlanner>(db, storage, symbol_table);
@ -577,7 +577,7 @@ struct ExpectedDistributedPlan {
};
template <class TPlanner>
DistributedPlan MakeDistributedPlan(query::AstTreeStorage &storage) {
DistributedPlan MakeDistributedPlan(query::AstStorage &storage) {
database::Master db;
auto symbol_table = MakeSymbolTable(*storage.query());
auto planner = MakePlanner<TPlanner>(db, storage, symbol_table);
@ -616,7 +616,7 @@ void CheckDistributedPlan(const LogicalOperator &plan,
}
template <class TPlanner>
void CheckDistributedPlan(AstTreeStorage &storage,
void CheckDistributedPlan(AstStorage &storage,
ExpectedDistributedPlan &expected_distributed_plan) {
auto distributed_plan = MakeDistributedPlan<TPlanner>(storage);
CheckDistributedPlan(distributed_plan, expected_distributed_plan);
@ -682,7 +682,7 @@ TYPED_TEST_CASE(TestPlanner, PlannerTypes);
TYPED_TEST(TestPlanner, MatchNodeReturn) {
// Test MATCH (n) RETURN n
AstTreeStorage storage;
AstStorage storage;
auto *as_n = NEXPR("n", IDENT("n"));
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"))), RETURN(as_n)));
auto symbol_table = MakeSymbolTable(*storage.query());
@ -698,7 +698,7 @@ TYPED_TEST(TestPlanner, MatchNodeReturn) {
TYPED_TEST(TestPlanner, CreateNodeReturn) {
// Test CREATE (n) RETURN n AS n
AstTreeStorage storage;
AstStorage storage;
auto ident_n = IDENT("n");
auto query =
QUERY(SINGLE_QUERY(CREATE(PATTERN(NODE("n"))), RETURN(ident_n, AS("n"))));
@ -720,7 +720,7 @@ TYPED_TEST(TestPlanner, CreateNodeReturn) {
TYPED_TEST(TestPlanner, CreateExpand) {
// Test CREATE (n) -[r :rel1]-> (m)
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto relationship = dba.EdgeType("relationship");
@ -736,7 +736,7 @@ TYPED_TEST(TestPlanner, CreateExpand) {
TYPED_TEST(TestPlanner, CreateMultipleNode) {
// Test CREATE (n), (m)
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(CREATE(PATTERN(NODE("n")), PATTERN(NODE("m")))));
CheckPlan<TypeParam>(storage, ExpectCreateNode(), ExpectCreateNode());
ExpectedDistributedPlan expected{
@ -748,7 +748,7 @@ TYPED_TEST(TestPlanner, CreateMultipleNode) {
TYPED_TEST(TestPlanner, CreateNodeExpandNode) {
// Test CREATE (n) -[r :rel]-> (m), (l)
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto relationship = dba.EdgeType("rel");
@ -766,7 +766,7 @@ TYPED_TEST(TestPlanner, CreateNodeExpandNode) {
TYPED_TEST(TestPlanner, CreateNamedPattern) {
// Test CREATE p = (n) -[r :rel]-> (m)
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto relationship = dba.EdgeType("rel");
@ -783,7 +783,7 @@ TYPED_TEST(TestPlanner, CreateNamedPattern) {
TYPED_TEST(TestPlanner, MatchCreateExpand) {
// Test MATCH (n) CREATE (n) -[r :rel1]-> (m)
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto relationship = dba.EdgeType("relationship");
@ -800,7 +800,7 @@ TYPED_TEST(TestPlanner, MatchCreateExpand) {
TYPED_TEST(TestPlanner, MatchLabeledNodes) {
// Test MATCH (n :label) RETURN n
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto label = dba.Label("label");
@ -819,7 +819,7 @@ TYPED_TEST(TestPlanner, MatchLabeledNodes) {
TYPED_TEST(TestPlanner, MatchPathReturn) {
// Test MATCH (n) -[r :relationship]- (m) RETURN n
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto relationship = dba.EdgeType("relationship");
@ -841,7 +841,7 @@ TYPED_TEST(TestPlanner, MatchPathReturn) {
TYPED_TEST(TestPlanner, MatchNamedPatternReturn) {
// Test MATCH p = (n) -[r :relationship]- (m) RETURN p
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto relationship = dba.EdgeType("relationship");
@ -866,7 +866,7 @@ TYPED_TEST(TestPlanner, MatchNamedPatternReturn) {
TYPED_TEST(TestPlanner, MatchNamedPatternWithPredicateReturn) {
// Test MATCH p = (n) -[r :relationship]- (m) WHERE 2 = p RETURN p
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto relationship = dba.EdgeType("relationship");
@ -892,7 +892,7 @@ TYPED_TEST(TestPlanner, MatchNamedPatternWithPredicateReturn) {
TYPED_TEST(TestPlanner, OptionalMatchNamedPatternReturn) {
// Test OPTIONAL MATCH p = (n) -[r]- (m) RETURN p
database::SingleNode db;
AstTreeStorage storage;
AstStorage storage;
auto node_n = NODE("n");
auto edge = EDGE("r");
auto node_m = NODE("m");
@ -920,7 +920,7 @@ TYPED_TEST(TestPlanner, OptionalMatchNamedPatternReturn) {
TYPED_TEST(TestPlanner, MatchWhereReturn) {
// Test MATCH (n) WHERE n.property < 42 RETURN n
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto property = dba.Property("property");
@ -941,7 +941,7 @@ TYPED_TEST(TestPlanner, MatchWhereReturn) {
TYPED_TEST(TestPlanner, MatchDelete) {
// Test MATCH (n) DELETE n
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"))), DELETE(IDENT("n"))));
CheckPlan<TypeParam>(storage, ExpectScanAll(), ExpectDelete());
auto expected = ExpectDistributed(
@ -952,7 +952,7 @@ TYPED_TEST(TestPlanner, MatchDelete) {
TYPED_TEST(TestPlanner, MatchNodeSet) {
// Test MATCH (n) SET n.prop = 42, n = n, n :label
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
@ -972,7 +972,7 @@ TYPED_TEST(TestPlanner, MatchNodeSet) {
TYPED_TEST(TestPlanner, MatchRemove) {
// Test MATCH (n) REMOVE n.prop REMOVE n :label
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
@ -991,7 +991,7 @@ TYPED_TEST(TestPlanner, MatchRemove) {
TYPED_TEST(TestPlanner, MatchMultiPattern) {
// Test MATCH (n) -[r]- (m), (j) -[e]- (i) RETURN n
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m")),
PATTERN(NODE("j"), EDGE("e"), NODE("i"))),
RETURN("n")));
@ -1004,7 +1004,7 @@ TYPED_TEST(TestPlanner, MatchMultiPattern) {
TYPED_TEST(TestPlanner, MatchMultiPatternSameStart) {
// Test MATCH (n), (n) -[e]- (m) RETURN n
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n")), PATTERN(NODE("n"), EDGE("e"), NODE("m"))),
RETURN("n")));
@ -1016,7 +1016,7 @@ TYPED_TEST(TestPlanner, MatchMultiPatternSameStart) {
TYPED_TEST(TestPlanner, MatchMultiPatternSameExpandStart) {
// Test MATCH (n) -[r]- (m), (m) -[e]- (l) RETURN n
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m")),
PATTERN(NODE("m"), EDGE("e"), NODE("l"))),
RETURN("n")));
@ -1030,7 +1030,7 @@ TYPED_TEST(TestPlanner, MatchMultiPatternSameExpandStart) {
TYPED_TEST(TestPlanner, MultiMatch) {
// Test MATCH (n) -[r]- (m) MATCH (j) -[e]- (i) -[f]- (h) RETURN n
AstTreeStorage storage;
AstStorage storage;
auto *node_n = NODE("n");
auto *edge_r = EDGE("r");
auto *node_m = NODE("m");
@ -1073,7 +1073,7 @@ TYPED_TEST(TestPlanner, MultiMatch) {
TYPED_TEST(TestPlanner, MultiMatchSameStart) {
// Test MATCH (n) MATCH (n) -[r]- (m) RETURN n
AstTreeStorage storage;
AstStorage storage;
auto *as_n = NEXPR("n", IDENT("n"));
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"))),
MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m"))),
@ -1094,7 +1094,7 @@ TYPED_TEST(TestPlanner, MultiMatchSameStart) {
TYPED_TEST(TestPlanner, MatchWithReturn) {
// Test MATCH (old) WITH old AS new RETURN new
AstTreeStorage storage;
AstStorage storage;
auto *as_new = NEXPR("new", IDENT("new"));
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("old"))), WITH("old", AS("new")),
RETURN(as_new)));
@ -1116,7 +1116,7 @@ TYPED_TEST(TestPlanner, MatchWithWhereReturn) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto *as_new = NEXPR("new", IDENT("new"));
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("old"))), WITH("old", AS("new")),
WHERE(LESS(PROPERTY_LOOKUP("new", prop), LITERAL(42))),
@ -1141,7 +1141,7 @@ TYPED_TEST(TestPlanner, CreateMultiExpand) {
database::GraphDbAccessor dba(db);
auto r = dba.EdgeType("r");
auto p = dba.EdgeType("p");
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
CREATE(PATTERN(NODE("n"), EDGE("r", Direction::OUT, {r}), NODE("m")),
PATTERN(NODE("n"), EDGE("p", Direction::OUT, {p}), NODE("l")))));
@ -1160,7 +1160,7 @@ TYPED_TEST(TestPlanner, MatchWithSumWhereReturn) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(PROPERTY_LOOKUP("n", prop));
auto literal = LITERAL(42);
QUERY(SINGLE_QUERY(
@ -1177,7 +1177,7 @@ TYPED_TEST(TestPlanner, MatchReturnSum) {
database::GraphDbAccessor dba(db);
auto prop1 = dba.Property("prop1");
auto prop2 = dba.Property("prop2");
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(PROPERTY_LOOKUP("n", prop1));
auto n_prop2 = PROPERTY_LOOKUP("n", prop2);
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"))),
@ -1208,7 +1208,7 @@ TYPED_TEST(TestPlanner, CreateWithSum) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto n_prop = PROPERTY_LOOKUP("n", prop);
auto sum = SUM(n_prop);
auto query =
@ -1228,7 +1228,7 @@ TYPED_TEST(TestPlanner, MatchWithCreate) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto r_type = dba.EdgeType("r");
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"))), WITH("n", AS("a")),
CREATE(
@ -1244,7 +1244,7 @@ TYPED_TEST(TestPlanner, MatchWithCreate) {
TYPED_TEST(TestPlanner, MatchReturnSkipLimit) {
// Test MATCH (n) RETURN n SKIP 2 LIMIT 1
AstTreeStorage storage;
AstStorage storage;
auto *as_n = NEXPR("n", IDENT("n"));
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"))),
RETURN(as_n, SKIP(LITERAL(2)), LIMIT(LITERAL(1)))));
@ -1263,7 +1263,7 @@ TYPED_TEST(TestPlanner, MatchReturnSkipLimit) {
TYPED_TEST(TestPlanner, CreateWithSkipReturnLimit) {
// Test CREATE (n) WITH n AS m SKIP 2 RETURN m LIMIT 1
AstTreeStorage storage;
AstStorage storage;
auto ident_n = IDENT("n");
auto query = QUERY(SINGLE_QUERY(CREATE(PATTERN(NODE("n"))),
WITH(ident_n, AS("m"), SKIP(LITERAL(2))),
@ -1292,7 +1292,7 @@ TYPED_TEST(TestPlanner, CreateReturnSumSkipLimit) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto n_prop = PROPERTY_LOOKUP("n", prop);
auto sum = SUM(n_prop);
auto query = QUERY(
@ -1311,7 +1311,7 @@ TYPED_TEST(TestPlanner, MatchReturnOrderBy) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto *as_m = NEXPR("m", IDENT("n"));
auto *node_n = NODE("n");
auto ret = RETURN(as_m, ORDER_BY(PROPERTY_LOOKUP("n", prop)));
@ -1340,7 +1340,7 @@ TYPED_TEST(TestPlanner, CreateWithOrderByWhere) {
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
auto r_type = dba.EdgeType("r");
AstTreeStorage storage;
AstStorage storage;
auto ident_n = IDENT("n");
auto new_prop = PROPERTY_LOOKUP("new", prop);
auto r_prop = PROPERTY_LOOKUP("r", prop);
@ -1369,7 +1369,7 @@ TYPED_TEST(TestPlanner, CreateWithOrderByWhere) {
TYPED_TEST(TestPlanner, ReturnAddSumCountOrderBy) {
// Test RETURN SUM(1) + COUNT(2) AS result ORDER BY result
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(LITERAL(1));
auto count = COUNT(LITERAL(2));
QUERY(SINGLE_QUERY(
@ -1389,7 +1389,7 @@ TYPED_TEST(TestPlanner, MatchMerge) {
database::GraphDbAccessor dba(db);
auto r_type = dba.EdgeType("r");
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto ident_n = IDENT("n");
auto query = QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"))),
@ -1418,7 +1418,7 @@ TYPED_TEST(TestPlanner, MatchOptionalMatchWhereReturn) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"))),
OPTIONAL_MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m"))),
WHERE(LESS(PROPERTY_LOOKUP("m", prop), LITERAL(42))),
@ -1431,7 +1431,7 @@ TYPED_TEST(TestPlanner, MatchOptionalMatchWhereReturn) {
TYPED_TEST(TestPlanner, MatchUnwindReturn) {
// Test MATCH (n) UNWIND [1,2,3] AS x RETURN n, x
AstTreeStorage storage;
AstStorage storage;
auto *as_n = NEXPR("n", IDENT("n"));
auto *as_x = NEXPR("x", IDENT("x"));
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"))),
@ -1451,7 +1451,7 @@ TYPED_TEST(TestPlanner, MatchUnwindReturn) {
TYPED_TEST(TestPlanner, ReturnDistinctOrderBySkipLimit) {
// Test RETURN DISTINCT 1 ORDER BY 1 SKIP 1 LIMIT 1
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(RETURN_DISTINCT(LITERAL(1), AS("1"), ORDER_BY(LITERAL(1)),
SKIP(LITERAL(1)), LIMIT(LITERAL(1)))));
CheckPlan<TypeParam>(storage, ExpectProduce(), ExpectDistinct(),
@ -1467,7 +1467,7 @@ TYPED_TEST(TestPlanner, CreateWithDistinctSumWhereReturn) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto node_n = NODE("n");
auto sum = SUM(PROPERTY_LOOKUP("n", prop));
auto query =
@ -1486,7 +1486,7 @@ TYPED_TEST(TestPlanner, MatchCrossReferenceVariable) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = PROPERTY_PAIR("prop");
AstTreeStorage storage;
AstStorage storage;
auto node_n = NODE("n");
auto m_prop = PROPERTY_LOOKUP("m", prop.second);
node_n->properties_[prop] = m_prop;
@ -1505,7 +1505,7 @@ TYPED_TEST(TestPlanner, MatchWhereBeforeExpand) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto *as_n = NEXPR("n", IDENT("n"));
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m"))),
WHERE(LESS(PROPERTY_LOOKUP("n", prop), LITERAL(42))),
@ -1529,7 +1529,7 @@ TYPED_TEST(TestPlanner, MultiMatchWhere) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m"))),
MATCH(PATTERN(NODE("l"))),
WHERE(LESS(PROPERTY_LOOKUP("n", prop), LITERAL(42))),
@ -1545,7 +1545,7 @@ TYPED_TEST(TestPlanner, MatchOptionalMatchWhere) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m"))),
OPTIONAL_MATCH(PATTERN(NODE("l"))),
WHERE(LESS(PROPERTY_LOOKUP("n", prop), LITERAL(42))),
@ -1563,7 +1563,7 @@ TYPED_TEST(TestPlanner, MatchReturnAsterisk) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto ret = RETURN(PROPERTY_LOOKUP("m", prop), AS("m.prop"));
ret->body_.all_identifiers = true;
auto query =
@ -1585,7 +1585,7 @@ TYPED_TEST(TestPlanner, MatchReturnAsteriskSum) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(PROPERTY_LOOKUP("n", prop));
auto ret = RETURN(sum, AS("s"));
ret->body_.all_identifiers = true;
@ -1614,7 +1614,7 @@ TYPED_TEST(TestPlanner, UnwindMergeNodeProperty) {
// Test UNWIND [1] AS i MERGE (n {prop: i})
database::SingleNode db;
database::GraphDbAccessor dba(db);
AstTreeStorage storage;
AstStorage storage;
auto node_n = NODE("n");
node_n->properties_[PROPERTY_PAIR("prop")] = IDENT("i");
QUERY(
@ -1629,7 +1629,7 @@ TYPED_TEST(TestPlanner, UnwindMergeNodeProperty) {
TYPED_TEST(TestPlanner, MultipleOptionalMatchReturn) {
// Test OPTIONAL MATCH (n) OPTIONAL MATCH (m) RETURN n
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(OPTIONAL_MATCH(PATTERN(NODE("n"))),
OPTIONAL_MATCH(PATTERN(NODE("m"))), RETURN("n")));
std::list<BaseOpChecker *> optional{new ExpectScanAll()};
@ -1639,7 +1639,7 @@ TYPED_TEST(TestPlanner, MultipleOptionalMatchReturn) {
TYPED_TEST(TestPlanner, FunctionAggregationReturn) {
// Test RETURN sqrt(SUM(2)) AS result, 42 AS group_by
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(LITERAL(2));
auto group_by_literal = LITERAL(42);
QUERY(SINGLE_QUERY(
@ -1652,7 +1652,7 @@ TYPED_TEST(TestPlanner, FunctionAggregationReturn) {
TYPED_TEST(TestPlanner, FunctionWithoutArguments) {
// Test RETURN pi() AS pi
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(RETURN(FN("pi"), AS("pi"))));
CheckPlan<TypeParam>(storage, ExpectProduce());
auto expected = ExpectDistributed(MakeCheckers(ExpectProduce()));
@ -1661,7 +1661,7 @@ TYPED_TEST(TestPlanner, FunctionWithoutArguments) {
TYPED_TEST(TestPlanner, ListLiteralAggregationReturn) {
// Test RETURN [SUM(2)] AS result, 42 AS group_by
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(LITERAL(2));
auto group_by_literal = LITERAL(42);
QUERY(SINGLE_QUERY(
@ -1672,7 +1672,7 @@ TYPED_TEST(TestPlanner, ListLiteralAggregationReturn) {
TYPED_TEST(TestPlanner, MapLiteralAggregationReturn) {
// Test RETURN {sum: SUM(2)} AS result, 42 AS group_by
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto sum = SUM(LITERAL(2));
@ -1685,7 +1685,7 @@ TYPED_TEST(TestPlanner, MapLiteralAggregationReturn) {
TYPED_TEST(TestPlanner, EmptyListIndexAggregation) {
// Test RETURN [][SUM(2)] AS result, 42 AS group_by
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(LITERAL(2));
auto empty_list = LIST();
auto group_by_literal = LITERAL(42);
@ -1701,7 +1701,7 @@ TYPED_TEST(TestPlanner, EmptyListIndexAggregation) {
TYPED_TEST(TestPlanner, ListSliceAggregationReturn) {
// Test RETURN [1, 2][0..SUM(2)] AS result, 42 AS group_by
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(LITERAL(2));
auto list = LIST(LITERAL(1), LITERAL(2));
auto group_by_literal = LITERAL(42);
@ -1715,7 +1715,7 @@ TYPED_TEST(TestPlanner, ListSliceAggregationReturn) {
TYPED_TEST(TestPlanner, ListWithAggregationAndGroupBy) {
// Test RETURN [sum(2), 42]
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(LITERAL(2));
auto group_by_literal = LITERAL(42);
QUERY(SINGLE_QUERY(RETURN(LIST(sum, group_by_literal), AS("result"))));
@ -1725,7 +1725,7 @@ TYPED_TEST(TestPlanner, ListWithAggregationAndGroupBy) {
TYPED_TEST(TestPlanner, AggregatonWithListWithAggregationAndGroupBy) {
// Test RETURN sum(2), [sum(3), 42]
AstTreeStorage storage;
AstStorage storage;
auto sum2 = SUM(LITERAL(2));
auto sum3 = SUM(LITERAL(3));
auto group_by_literal = LITERAL(42);
@ -1738,7 +1738,7 @@ TYPED_TEST(TestPlanner, AggregatonWithListWithAggregationAndGroupBy) {
TYPED_TEST(TestPlanner, MapWithAggregationAndGroupBy) {
// Test RETURN {lit: 42, sum: sum(2)}
database::SingleNode db;
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(LITERAL(2));
auto group_by_literal = LITERAL(42);
QUERY(SINGLE_QUERY(RETURN(MAP({PROPERTY_PAIR("sum"), sum},
@ -1754,7 +1754,7 @@ TYPED_TEST(TestPlanner, CreateIndex) {
database::GraphDbAccessor dba(db);
auto label = dba.Label("label");
auto property = dba.Property("property");
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(CREATE_INDEX_ON(label, property)));
CheckPlan<TypeParam>(storage, ExpectCreateIndex(label, property));
auto expected =
@ -1764,7 +1764,7 @@ TYPED_TEST(TestPlanner, CreateIndex) {
TYPED_TEST(TestPlanner, AtomIndexedLabelProperty) {
// Test MATCH (n :label {property: 42, not_indexed: 0}) RETURN n
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto label = dba.Label("label");
@ -1791,7 +1791,7 @@ TYPED_TEST(TestPlanner, AtomIndexedLabelProperty) {
TYPED_TEST(TestPlanner, AtomPropertyWhereLabelIndexing) {
// Test MATCH (n {property: 42}) WHERE n.not_indexed AND n:label RETURN n
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto label = dba.Label("label");
@ -1818,7 +1818,7 @@ TYPED_TEST(TestPlanner, AtomPropertyWhereLabelIndexing) {
TYPED_TEST(TestPlanner, WhereIndexedLabelProperty) {
// Test MATCH (n :label) WHERE n.property = 42 RETURN n
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto label = dba.Label("label");
@ -1839,7 +1839,7 @@ TYPED_TEST(TestPlanner, WhereIndexedLabelProperty) {
TYPED_TEST(TestPlanner, BestPropertyIndexed) {
// Test MATCH (n :label) WHERE n.property = 1 AND n.better = 42 RETURN n
AstTreeStorage storage;
AstStorage storage;
database::SingleNode db;
auto label = database::GraphDbAccessor(db).Label("label");
auto property = database::GraphDbAccessor(db).Property("property");
@ -1882,7 +1882,7 @@ TYPED_TEST(TestPlanner, MultiPropertyIndexScan) {
auto prop2 = PROPERTY_PAIR("prop2");
database::GraphDbAccessor(db).BuildIndex(label1, prop1.second);
database::GraphDbAccessor(db).BuildIndex(label2, prop2.second);
AstTreeStorage storage;
AstStorage storage;
auto lit_1 = LITERAL(1);
auto lit_2 = LITERAL(2);
QUERY(SINGLE_QUERY(
@ -1905,14 +1905,14 @@ TYPED_TEST(TestPlanner, WhereIndexedLabelPropertyRange) {
auto label = database::GraphDbAccessor(db).Label("label");
auto property = database::GraphDbAccessor(db).Property("property");
database::GraphDbAccessor(db).BuildIndex(label, property);
AstTreeStorage storage;
AstStorage storage;
auto lit_42 = LITERAL(42);
auto n_prop = PROPERTY_LOOKUP("n", property);
auto check_planned_range = [&label, &property, &db](const auto &rel_expr,
auto lower_bound,
auto upper_bound) {
// Shadow the first storage, so that the query is created in this one.
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n", label))), WHERE(rel_expr),
RETURN("n")));
auto symbol_table = MakeSymbolTable(*storage.query());
@ -1956,7 +1956,7 @@ TYPED_TEST(TestPlanner, UnableToUsePropertyIndex) {
auto property = dba.Property("property");
dba.BuildIndex(label, property);
{
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n", label))),
WHERE(EQ(PROPERTY_LOOKUP("n", property),
PROPERTY_LOOKUP("n", property))),
@ -1978,7 +1978,7 @@ TYPED_TEST(TestPlanner, SecondPropertyIndex) {
auto property = PROPERTY_PAIR("property");
dba.BuildIndex(label, dba.Property("property"));
{
AstTreeStorage storage;
AstStorage storage;
auto n_prop = PROPERTY_LOOKUP("n", property);
auto m_prop = PROPERTY_LOOKUP("m", property);
QUERY(SINGLE_QUERY(
@ -1996,7 +1996,7 @@ TYPED_TEST(TestPlanner, SecondPropertyIndex) {
TYPED_TEST(TestPlanner, ReturnSumGroupByAll) {
// Test RETURN sum([1,2,3]), all(x in [1] where x = 1)
AstTreeStorage storage;
AstStorage storage;
auto sum = SUM(LIST(LITERAL(1), LITERAL(2), LITERAL(3)));
auto *all = ALL("x", LIST(LITERAL(1)), WHERE(EQ(IDENT("x"), LITERAL(1))));
QUERY(SINGLE_QUERY(RETURN(sum, AS("sum"), all, AS("all"))));
@ -2006,7 +2006,7 @@ TYPED_TEST(TestPlanner, ReturnSumGroupByAll) {
TYPED_TEST(TestPlanner, MatchExpandVariable) {
// Test MATCH (n) -[r *..3]-> (m) RETURN r
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r");
edge->upper_bound_ = LITERAL(3);
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), edge, NODE("m"))), RETURN("r")));
@ -2016,7 +2016,7 @@ TYPED_TEST(TestPlanner, MatchExpandVariable) {
TYPED_TEST(TestPlanner, MatchExpandVariableNoBounds) {
// Test MATCH (n) -[r *]-> (m) RETURN r
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r");
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), edge, NODE("m"))), RETURN("r")));
CheckPlan<TypeParam>(storage, ExpectScanAll(), ExpectExpandVariable(),
@ -2029,7 +2029,7 @@ TYPED_TEST(TestPlanner, MatchExpandVariableInlinedFilter) {
database::GraphDbAccessor dba(db);
auto type = dba.EdgeType("type");
auto prop = PROPERTY_PAIR("prop");
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r", Direction::BOTH, {type});
edge->properties_[prop] = LITERAL(42);
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), edge, NODE("m"))), RETURN("r")));
@ -2045,7 +2045,7 @@ TYPED_TEST(TestPlanner, MatchExpandVariableNotInlinedFilter) {
database::GraphDbAccessor dba(db);
auto type = dba.EdgeType("type");
auto prop = PROPERTY_PAIR("prop");
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r", Direction::BOTH, {type});
edge->properties_[prop] = EQ(PROPERTY_LOOKUP("m", prop), LITERAL(42));
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), edge, NODE("m"))), RETURN("r")));
@ -2055,7 +2055,7 @@ TYPED_TEST(TestPlanner, MatchExpandVariableNotInlinedFilter) {
TYPED_TEST(TestPlanner, UnwindMatchVariable) {
// Test UNWIND [1,2,3] AS depth MATCH (n) -[r*d]-> (m) RETURN r
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r", Direction::OUT);
edge->lower_bound_ = IDENT("d");
edge->upper_bound_ = IDENT("d");
@ -2070,7 +2070,7 @@ TYPED_TEST(TestPlanner, MatchBfs) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto edge_type = dba.EdgeType("type");
AstTreeStorage storage;
AstStorage storage;
auto *bfs = storage.Create<query::EdgeAtom>(
IDENT("r"), query::EdgeAtom::Type::BREADTH_FIRST, Direction::OUT,
std::vector<storage::EdgeType>{edge_type});
@ -2088,7 +2088,7 @@ TYPED_TEST(TestPlanner, MatchDoubleScanToExpandExisting) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto label = dba.Label("label");
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m", label))),
RETURN("r")));
auto symbol_table = MakeSymbolTable(*storage.query());
@ -2118,7 +2118,7 @@ TYPED_TEST(TestPlanner, MatchScanToExpand) {
vertex.PropsSet(property, 1);
dba.Commit();
{
AstTreeStorage storage;
AstStorage storage;
auto node_m = NODE("m", label);
node_m->properties_[std::make_pair("property", property)] = LITERAL(1);
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), node_m)),
@ -2137,7 +2137,7 @@ TYPED_TEST(TestPlanner, MatchWhereAndSplit) {
database::SingleNode db;
database::GraphDbAccessor dba(db);
auto prop = PROPERTY_PAIR("prop");
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m"))),
WHERE(AND(PROPERTY_LOOKUP("n", prop), PROPERTY_LOOKUP("r", prop))),
@ -2150,7 +2150,7 @@ TYPED_TEST(TestPlanner, MatchWhereAndSplit) {
TYPED_TEST(TestPlanner, ReturnAsteriskOmitsLambdaSymbols) {
// Test MATCH (n) -[r* (ie, in | true)]- (m) RETURN *
database::SingleNode db;
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r", Direction::BOTH);
edge->filter_lambda_.inner_edge = IDENT("ie");
edge->filter_lambda_.inner_node = IDENT("in");
@ -2175,7 +2175,7 @@ TYPED_TEST(TestPlanner, ReturnAsteriskOmitsLambdaSymbols) {
TYPED_TEST(TestPlanner, DistributedAvg) {
// Test MATCH (n) RETURN AVG(n.prop) AS res
AstTreeStorage storage;
AstStorage storage;
database::Master db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
@ -2209,7 +2209,7 @@ TYPED_TEST(TestPlanner, DistributedAvg) {
TYPED_TEST(TestPlanner, DistributedCollectList) {
// Test MATCH (n) RETURN COLLECT(n.prop) AS res
AstTreeStorage storage;
AstStorage storage;
database::Master db;
database::GraphDbAccessor dba(db);
auto prop = dba.Property("prop");
@ -2228,7 +2228,7 @@ TYPED_TEST(TestPlanner, DistributedCollectList) {
TYPED_TEST(TestPlanner, DistributedMatchCreateReturn) {
// Test MATCH (n) CREATE (m) RETURN m
AstTreeStorage storage;
AstStorage storage;
auto *ident_m = IDENT("m");
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"))), CREATE(PATTERN(NODE("m"))),
RETURN(ident_m, AS("m"))));
@ -2246,7 +2246,7 @@ TYPED_TEST(TestPlanner, DistributedMatchCreateReturn) {
TYPED_TEST(TestPlanner, DistributedCartesianCreate) {
// Test MATCH (a), (b) CREATE (a)-[e:r]->(b) RETURN e
AstTreeStorage storage;
AstStorage storage;
database::Master db;
database::GraphDbAccessor dba(db);
auto relationship = dba.EdgeType("r");
@ -2284,7 +2284,7 @@ TEST(CapnpSerial, Union) {
std::unique_ptr<LogicalOperator> loaded_plan;
::capnp::MallocMessageBuilder message;
SavePlan(*union_op, &message);
AstTreeStorage new_storage;
AstStorage new_storage;
std::tie(loaded_plan, new_storage) =
LoadPlan(message.getRoot<query::plan::capnp::LogicalOperator>());
ASSERT_TRUE(loaded_plan);
@ -2307,7 +2307,7 @@ TEST(CapnpSerial, Cartesian) {
std::unique_ptr<LogicalOperator> loaded_plan;
::capnp::MallocMessageBuilder message;
SavePlan(*cartesian, &message);
AstTreeStorage new_storage;
AstStorage new_storage;
std::tie(loaded_plan, new_storage) =
LoadPlan(message.getRoot<query::plan::capnp::LogicalOperator>());
ASSERT_TRUE(loaded_plan);
@ -2324,7 +2324,7 @@ TEST(CapnpSerial, Synchronize) {
std::unique_ptr<LogicalOperator> loaded_plan;
::capnp::MallocMessageBuilder message;
SavePlan(*synchronize, &message);
AstTreeStorage new_storage;
AstStorage new_storage;
std::tie(loaded_plan, new_storage) =
LoadPlan(message.getRoot<query::plan::capnp::LogicalOperator>());
ASSERT_TRUE(loaded_plan);
@ -2342,7 +2342,7 @@ TEST(CapnpSerial, PullRemote) {
std::unique_ptr<LogicalOperator> loaded_plan;
::capnp::MallocMessageBuilder message;
SavePlan(*pull_remote, &message);
AstTreeStorage new_storage;
AstStorage new_storage;
std::tie(loaded_plan, new_storage) =
LoadPlan(message.getRoot<query::plan::capnp::LogicalOperator>());
ASSERT_TRUE(loaded_plan);
@ -2355,7 +2355,7 @@ TEST(CapnpSerial, PullRemote) {
TEST(CapnpSerial, PullRemoteOrderBy) {
auto once = std::make_shared<Once>();
AstTreeStorage storage;
AstStorage storage;
std::vector<Symbol> symbols{
Symbol("my_symbol", 2, true, Symbol::Type::Vertex, 3)};
std::vector<std::pair<query::Ordering, query::Expression *>> order_by{
@ -2365,7 +2365,7 @@ TEST(CapnpSerial, PullRemoteOrderBy) {
std::unique_ptr<LogicalOperator> loaded_plan;
::capnp::MallocMessageBuilder message;
SavePlan(*pull_remote_order_by, &message);
AstTreeStorage new_storage;
AstStorage new_storage;
std::tie(loaded_plan, new_storage) =
LoadPlan(message.getRoot<query::plan::capnp::LogicalOperator>());
ASSERT_TRUE(loaded_plan);

View File

@ -19,7 +19,7 @@ class TestSymbolGenerator : public ::testing::Test {
database::GraphDbAccessor dba{db};
SymbolTable symbol_table;
SymbolGenerator symbol_generator{symbol_table};
AstTreeStorage storage;
AstStorage storage;
};
TEST_F(TestSymbolGenerator, MatchNodeReturn) {
@ -1091,7 +1091,7 @@ TEST_F(TestSymbolGenerator, MatchUnion) {
TEST(TestSymbolTable, Serialization) {
SymbolTable original_table;
SymbolGenerator symbol_generator{original_table};
AstTreeStorage storage;
AstStorage storage;
auto ident_a = IDENT("a");
auto sym_a = original_table.CreateSymbol("a", true, Symbol::Type::Vertex, 0);
original_table[*ident_a] = sym_a;

View File

@ -10,7 +10,7 @@
#include "query_plan_common.hpp"
using namespace query::plan;
using query::AstTreeStorage;
using query::AstStorage;
using Direction = query::EdgeAtom::Direction;
namespace std {
@ -63,7 +63,7 @@ void AssertRows(const std::vector<std::vector<TypedValue>> &datum,
};
void CheckPlansProduce(
size_t expected_plan_count, AstTreeStorage &storage,
size_t expected_plan_count, AstStorage &storage,
database::GraphDbAccessor &dba,
std::function<void(const std::vector<std::vector<TypedValue>> &)> check) {
auto symbol_table = MakeSymbolTable(*storage.query());
@ -91,7 +91,7 @@ TEST(TestVariableStartPlanner, MatchReturn) {
dba.InsertEdge(v1, v2, dba.EdgeType("r"));
dba.AdvanceCommand();
// Test MATCH (n) -[r]-> (m) RETURN n
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"), EDGE("r", Direction::OUT), NODE("m"))),
RETURN("n")));
@ -114,7 +114,7 @@ TEST(TestVariableStartPlanner, MatchTripletPatternReturn) {
dba.AdvanceCommand();
{
// Test `MATCH (n) -[r]-> (m) -[e]-> (l) RETURN n`
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"), EDGE("r", Direction::OUT), NODE("m"),
EDGE("e", Direction::OUT), NODE("l"))),
@ -127,7 +127,7 @@ TEST(TestVariableStartPlanner, MatchTripletPatternReturn) {
}
{
// Equivalent to `MATCH (n) -[r]-> (m), (m) -[e]-> (l) RETURN n`.
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"), EDGE("r", Direction::OUT), NODE("m")),
PATTERN(NODE("m"), EDGE("e", Direction::OUT), NODE("l"))),
@ -149,7 +149,7 @@ TEST(TestVariableStartPlanner, MatchOptionalMatchReturn) {
dba.InsertEdge(v2, v3, dba.EdgeType("r"));
dba.AdvanceCommand();
// Test MATCH (n) -[r]-> (m) OPTIONAL MATCH (m) -[e]-> (l) RETURN n, l
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"), EDGE("r", Direction::OUT), NODE("m"))),
OPTIONAL_MATCH(PATTERN(NODE("m"), EDGE("e", Direction::OUT), NODE("l"))),
@ -175,7 +175,7 @@ TEST(TestVariableStartPlanner, MatchOptionalMatchMergeReturn) {
dba.AdvanceCommand();
// Test MATCH (n) -[r]-> (m) OPTIONAL MATCH (m) -[e]-> (l)
// MERGE (u) -[q:r]-> (v) RETURN n, m, l, u, v
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"), EDGE("r", Direction::OUT), NODE("m"))),
OPTIONAL_MATCH(PATTERN(NODE("m"), EDGE("e", Direction::OUT), NODE("l"))),
@ -198,7 +198,7 @@ TEST(TestVariableStartPlanner, MatchWithMatchReturn) {
dba.InsertEdge(v1, v2, dba.EdgeType("r"));
dba.AdvanceCommand();
// Test MATCH (n) -[r]-> (m) WITH n MATCH (m) -[r]-> (l) RETURN n, m, l
AstTreeStorage storage;
AstStorage storage;
QUERY(SINGLE_QUERY(
MATCH(PATTERN(NODE("n"), EDGE("r", Direction::OUT), NODE("m"))),
WITH("n"),
@ -223,7 +223,7 @@ TEST(TestVariableStartPlanner, MatchVariableExpand) {
auto r2 = dba.InsertEdge(v2, v3, dba.EdgeType("r2"));
dba.AdvanceCommand();
// Test MATCH (n) -[r*]-> (m) RETURN r
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r", Direction::OUT);
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), edge, NODE("m"))), RETURN("r")));
// We expect to get a single column with the following rows:
@ -250,7 +250,7 @@ TEST(TestVariableStartPlanner, MatchVariableExpandReferenceNode) {
auto r2 = dba.InsertEdge(v2, v3, dba.EdgeType("r2"));
dba.AdvanceCommand();
// Test MATCH (n) -[r*..n.id]-> (m) RETURN r
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r", Direction::OUT);
edge->upper_bound_ = PROPERTY_LOOKUP("n", id);
QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), edge, NODE("m"))), RETURN("r")));
@ -275,7 +275,7 @@ TEST(TestVariableStartPlanner, MatchVariableExpandBoth) {
auto r2 = dba.InsertEdge(v2, v3, dba.EdgeType("r2"));
dba.AdvanceCommand();
// Test MATCH (n {id:1}) -[r*]- (m) RETURN r
AstTreeStorage storage;
AstStorage storage;
auto edge = EDGE_VARIABLE("r", Direction::BOTH);
auto node_n = NODE("n");
node_n->properties_[std::make_pair("id", id)] = LITERAL(1);
@ -303,7 +303,7 @@ TEST(TestVariableStartPlanner, MatchBfs) {
dba.InsertEdge(v2, v3, dba.EdgeType("r2"));
dba.AdvanceCommand();
// Test MATCH (n) -[r *bfs..10](r, n | n.id <> 3)]-> (m) RETURN r
AstTreeStorage storage;
AstStorage storage;
auto *bfs = storage.Create<query::EdgeAtom>(
IDENT("r"), EdgeAtom::Type::BREADTH_FIRST, Direction::OUT,
std::vector<storage::EdgeType>{});