Bind UNWIND symbols during planning
Reviewers: florijan, mislav.bradac, buda Reviewed By: mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D371
This commit is contained in:
parent
842901ecd2
commit
8cdf87e109
@ -763,10 +763,11 @@ std::unique_ptr<LogicalOperator> MakeLogicalPlan(AstTreeStorage &storage,
|
||||
is_write = true;
|
||||
input_op = op;
|
||||
} else if (auto *unwind = dynamic_cast<query::Unwind *>(clause)) {
|
||||
const auto &symbol = symbol_table.at(*unwind->named_expression_);
|
||||
BindSymbol(bound_symbols, symbol);
|
||||
input_op =
|
||||
new plan::Unwind(std::shared_ptr<LogicalOperator>(input_op),
|
||||
unwind->named_expression_->expression_,
|
||||
symbol_table.at(*unwind->named_expression_));
|
||||
unwind->named_expression_->expression_, symbol);
|
||||
} else {
|
||||
throw utils::NotYetImplemented(
|
||||
"Encountered a clause which cannot be converted to operator(s)");
|
||||
|
@ -831,5 +831,20 @@ TEST(TestLogicalPlanner, MatchReturnAsteriskSum) {
|
||||
EXPECT_EQ(output_names, expected_names);
|
||||
}
|
||||
|
||||
TEST(TestLogicalPlanner, UnwindMergeNodeProperty) {
|
||||
// Test UNWIND [1] AS i MERGE (n {prop: i})
|
||||
Dbms dbms;
|
||||
auto dba = dbms.active();
|
||||
auto prop = dba->property("prop");
|
||||
AstTreeStorage storage;
|
||||
auto node_n = NODE("n");
|
||||
node_n->properties_[prop] = IDENT("i");
|
||||
QUERY(UNWIND(LIST(LITERAL(1)), AS("i")), MERGE(PATTERN(node_n)));
|
||||
std::list<BaseOpChecker *> on_match{new ExpectScanAll(), new ExpectFilter()};
|
||||
std::list<BaseOpChecker *> on_create{new ExpectCreateNode()};
|
||||
CheckPlan(storage, ExpectUnwind(), ExpectMerge(on_match, on_create));
|
||||
for (auto &op : on_match) delete op;
|
||||
for (auto &op : on_create) delete op;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user