Remove double scan with expand from the planner (#1085)
This commit is contained in:
parent
02eab6ab9c
commit
09fd5939da
@ -90,19 +90,8 @@ class IndexLookupRewriter final : public HierarchicalLogicalOperatorVisitor {
|
||||
return true;
|
||||
}
|
||||
|
||||
// See if it might be better to do ScanAllBy<Index> of the destination and
|
||||
// then do Expand to existing.
|
||||
bool PostVisit(Expand &expand) override {
|
||||
bool PostVisit(Expand & /*expand*/) override {
|
||||
prev_ops_.pop_back();
|
||||
if (expand.common_.existing_node) {
|
||||
return true;
|
||||
}
|
||||
ScanAll dst_scan(expand.input(), expand.common_.node_symbol, expand.view_);
|
||||
auto indexed_scan = GenScanByIndex(dst_scan, FLAGS_query_vertex_count_to_expand_existing);
|
||||
if (indexed_scan) {
|
||||
expand.set_input(std::move(indexed_scan));
|
||||
expand.common_.existing_node = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1280,19 +1280,6 @@ TYPED_TEST(TestPlanner, MatchBfs) {
|
||||
CheckPlan(planner.plan(), symbol_table, ExpectScanAll(), ExpectExpandBfs(), ExpectProduce());
|
||||
}
|
||||
|
||||
TYPED_TEST(TestPlanner, MatchDoubleScanToExpandExisting) {
|
||||
// Test MATCH (n) -[r]- (m :label) RETURN r
|
||||
FakeDbAccessor dba;
|
||||
auto label = "label";
|
||||
dba.SetIndexCount(dba.Label(label), 0);
|
||||
auto *query = QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m", label))), RETURN("r")));
|
||||
auto symbol_table = memgraph::query::MakeSymbolTable(query);
|
||||
auto planner = MakePlanner<TypeParam>(&dba, this->storage, symbol_table, query);
|
||||
// We expect 2x ScanAll and then Expand, since we are guessing that is
|
||||
// faster (due to low label index vertex count).
|
||||
CheckPlan(planner.plan(), symbol_table, ExpectScanAll(), ExpectScanAllByLabel(), ExpectExpand(), ExpectProduce());
|
||||
}
|
||||
|
||||
TYPED_TEST(TestPlanner, MatchScanToExpand) {
|
||||
// Test MATCH (n) -[r]- (m :label {property: 1}) RETURN r
|
||||
FakeDbAccessor dba;
|
||||
@ -1504,13 +1491,6 @@ TYPED_TEST(TestPlanner, ScanAllById) {
|
||||
CheckPlan<TypeParam>(query, this->storage, ExpectScanAllById(), ExpectProduce());
|
||||
}
|
||||
|
||||
TYPED_TEST(TestPlanner, ScanAllByIdExpandToExisting) {
|
||||
// Test MATCH (n)-[r]-(m) WHERE id(m) = 42 RETURN r
|
||||
auto *query = QUERY(SINGLE_QUERY(MATCH(PATTERN(NODE("n"), EDGE("r"), NODE("m"))),
|
||||
WHERE(EQ(FN("id", IDENT("m")), LITERAL(42))), RETURN("r")));
|
||||
CheckPlan<TypeParam>(query, this->storage, ExpectScanAll(), ExpectScanAllById(), ExpectExpand(), ExpectProduce());
|
||||
}
|
||||
|
||||
TYPED_TEST(TestPlanner, BfsToExisting) {
|
||||
// Test MATCH (n)-[r *bfs]-(m) WHERE id(m) = 42 RETURN r
|
||||
auto *bfs = this->storage.template Create<memgraph::query::EdgeAtom>(
|
||||
|
Loading…
Reference in New Issue
Block a user