Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed May 15, 2023
1 parent dfae2d6 commit 7937773
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 41 deletions.
3 changes: 3 additions & 0 deletions src/graph/planner/ngql/GoPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ StatusOr<SubPlan> GoPlanner::transform(AstContext* astCtx) {
preRootNode_ = node;
}
if (goCtx_->isSimple) {
// go from 'xxx' over edge yield distinct edge._dst as id |
// go from $-.id over edge yield distinct edge._dst
// above scenario, the second statement does not need the argument operator
startNode_ = preRootNode_;
goCtx_->vidsVar = varName;
} else {
Expand Down
91 changes: 50 additions & 41 deletions tests/tck/features/go/SimpleCase.feature
Original file line number Diff line number Diff line change
Expand Up @@ -366,23 +366,20 @@ Feature: Simple case
| count(*) |
| 28 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 17 | Aggregate | 15 | |
| 15 | Minus | 13,14 | |
| 13 | Project | 16 | |
| 16 | PassThrough | 12 | |
| 12 | Dedup | 11 | |
| 11 | Project | 10 | |
| 10 | HashInnerJoin | 5,9 | |
| 5 | Project | 4 | |
| 4 | Dedup | 3 | |
| 3 | ExpandAll | 2 | |
| 2 | Expand | 0 | |
| 0 | Start | | |
| 9 | ExpandAll | 8 | |
| 8 | Expand | 7 | |
| 7 | Argument | | |
| 14 | Project | 16 | |
| id | name | dependencies | operator info |
| 14 | Aggregate | 12 | |
| 12 | Minus | 10,11 | |
| 10 | Project | 13 | |
| 13 | PassThrough | 9 | |
| 9 | Project | 8 | |
| 8 | Dedup | 7 | |
| 7 | Expand | 5 | |
| 5 | Project | 4 | |
| 4 | Dedup | 3 | |
| 3 | ExpandAll | 2 | |
| 2 | Expand | 0 | |
| 0 | Start | | |
| 11 | Project | 13 | |

Scenario: other simple case
When profiling query:
Expand All @@ -393,18 +390,15 @@ Feature: Simple case
| count(*) |
| 0 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 12 | Aggregate | 11 | |
| 11 | Dedup | 10 | |
| 10 | Project | 9 | |
| 9 | HashInnerJoin | 4,8 | |
| 4 | Project | 3 | |
| 3 | Dedup | 2 | |
| 2 | Expand | 0 | |
| 0 | Start | | |
| 8 | ExpandAll | 7 | |
| 7 | Expand | 6 | |
| 6 | Argument | | |
| id | name | dependencies | operator info |
| 9 | Aggregate | 8 | |
| 8 | Project | 7 | |
| 7 | Dedup | 6 | |
| 6 | Expand | 4 | |
| 4 | Project | 3 | |
| 3 | Dedup | 2 | |
| 2 | Expand | 0 | |
| 0 | Start | | |
When profiling query:
"""
GO 1 STEP FROM "Tony Parker" OVER * YIELD distinct id($$) as id| GO 3 STEP FROM $-.id OVER * YIELD distinct id($$) | YIELD COUNT(*)
Expand All @@ -413,18 +407,33 @@ Feature: Simple case
| COUNT(*) |
| 22 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 12 | Aggregate | 11 | |
| 11 | Dedup | 10 | |
| 10 | Project | 9 | |
| 9 | HashInnerJoin | 4,8 | |
| 4 | Project | 3 | |
| 3 | Dedup | 2 | |
| 2 | Expand | 0 | |
| 0 | Start | | |
| 8 | ExpandAll | 7 | |
| 7 | Expand | 6 | |
| 6 | Argument | | |
| id | name | dependencies | operator info |
| 9 | Aggregate | 8 | |
| 8 | Project | 7 | |
| 7 | Dedup | 6 | |
| 6 | Expand | 4 | |
| 4 | Project | 3 | |
| 3 | Dedup | 2 | |
| 2 | Expand | 0 | |
| 0 | Start | | |
When profiling query:
"""
GO 1 STEP FROM "Tony Parker" OVER * YIELD distinct id($$) as id| GO 2 to 4 STEP FROM $-.id OVER * YIELD distinct id($$) | YIELD COUNT(*)
"""
Then the result should be, in any order, with relax comparison:
| COUNT(*) |
| 26 |
And the execution plan should be:
| id | name | dependencies | operator info |
| 10 | Aggregate | 9 | |
| 9 | Project | 8 | |
| 8 | Dedup | 7 | |
| 7 | Expand | 6 | |
| 6 | Expand | 4 | |
| 4 | Project | 3 | |
| 3 | Dedup | 2 | |
| 2 | Expand | 0 | |
| 0 | Start | | |

Scenario: could not be optimied cases
When profiling query:
Expand Down

0 comments on commit 7937773

Please sign in to comment.