Skip to content

Commit

Permalink
Removed GetEdgesTransformRule
Browse files Browse the repository at this point in the history
  • Loading branch information
wey-gu committed May 27, 2022
1 parent 0726413 commit 04df98a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 262 deletions.
1 change: 0 additions & 1 deletion src/graph/optimizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ nebula_add_library(
rule/PushLimitDownProjectRule.cpp
rule/EliminateRowCollectRule.cpp
rule/PushLimitDownScanAppendVerticesRule.cpp
rule/GetEdgesTransformRule.cpp
rule/GetEdgesTransformLimitRule.cpp
rule/PushLimitDownScanEdgesAppendVerticesRule.cpp
rule/PushTopNDownIndexScanRule.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/graph/optimizer/rule/GetEdgesTransformLimitRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ StatusOr<OptRule::TransformResult> GetEdgesTransformLimitRule::transform(
auto newAppendVerticesGroup = OptGroup::create(ctx);
auto colSize = appendVertices->colNames().size();
newAppendVertices->setOutputVar(appendVertices->outputVar());
newLimit->setInputVar(appendVertices->outputVar());
newLimit->setInputVar(newAppendVertices->outputVar());
newAppendVertices->setColNames(
{appendVertices->colNames()[colSize - 2], appendVertices->colNames()[colSize - 1]});
auto newAppendVerticesGroupNode = newAppendVerticesGroup->makeGroupNode(newAppendVertices);
Expand All @@ -119,7 +119,7 @@ StatusOr<OptRule::TransformResult> GetEdgesTransformLimitRule::transform(

auto *newProj = projectEdges(qctx, newScanEdges, traverse->colNames().back());
newProj->setInputVar(newScanEdges->outputVar());
newProj->setOutputVar(traverse->outputVar());
newProj->setOutputVar(newAppendVertices->inputVar());
newProj->setColNames({traverse->colNames().back()});
auto newProjGroup = OptGroup::create(ctx);
auto newProjGroupNode = newProjGroup->makeGroupNode(newProj);
Expand Down
169 changes: 0 additions & 169 deletions src/graph/optimizer/rule/GetEdgesTransformRule.cpp

This file was deleted.

90 changes: 0 additions & 90 deletions src/graph/optimizer/rule/GetEdgesTransformRule.h

This file was deleted.

23 changes: 23 additions & 0 deletions tests/tck/features/optimizer/GetEdgesTransformLimitRule.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2021 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License.
Feature: Push Limit down scan edges rule

Background:
Given a graph with space named "student"

Scenario: Not optimized to ScanEdges
When profiling query:
"""
MATCH p=()-[e]->()
RETURN p LIMIT 3
"""
Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down.
And the execution plan should be:
| id | name | dependencies | operator info |
| 15 | Project | 13 | |
| 13 | Limit | 5 | |
| 5 | AppendVertices | 4 | |
| 4 | Traverse | 12 | |
| 12 | ScanVertices | 3 | {"limit": "-1"} |
| 3 | Start | | |

0 comments on commit 04df98a

Please sign in to comment.