Skip to content

Commit

Permalink
Fix crash of seeking by variable in match clause (#5592)
Browse files Browse the repository at this point in the history
Fix seeking by variable crash

fix vesoft-inc/nebula-ent#2835
  • Loading branch information
yixinglu committed Jun 13, 2023
1 parent 57a29e1 commit 70b4eb2
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/graph/executor/query/IndexScanExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ folly::Future<Status> IndexScanExecutor::indexScan() {
}

if (ops.empty()) {
return finish(ResultBuilder().value(Value(List())).iter(Iterator::Kind::kProp).build());
return finish(ResultBuilder().value(Value(DataSet())).iter(Iterator::Kind::kProp).build());
}

if (ops.size() == 1u) {
Expand Down
120 changes: 120 additions & 0 deletions tests/tck/features/match/MatchByVariable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1606,3 +1606,123 @@ Feature: Match By Variable
| 10 | Traverse | 1 | | |
| 1 | IndexScan | 2 | | |
| 2 | Start | | | |

Scenario: bugfix
When profiling query:
"""
match (v:player)
where id(v) == 'Yao Ming'
with v.player.name1 as name
match (v1:player)--(v2:player)
where v1.player.name==name
return count(*) as n
"""
Then the result should be, in any order, with relax comparison:
| n |
| 0 |
And the execution plan should be:
| id | name | dependencies | profiling data | operator info |
| 14 | Aggregate | 13 | | |
| 13 | Filter | 12 | | |
| 12 | CrossJoin | 6,11 | | |
| 6 | Project | 16 | | |
| 16 | AppendVertices | 2 | | |
| 2 | Dedup | 1 | | |
| 1 | PassThrough | 3 | | |
| 3 | Start | | | |
| 11 | Project | 18 | | |
| 18 | AppendVertices | 17 | | |
| 17 | Traverse | 8 | | |
| 8 | IndexScan | 7 | | |
| 7 | Argument | | | |
When profiling query:
"""
match (v:player)
where id(v) == 'A'
with v.player.name as name
match (v1:player)--(v2:player)
where v1.player.name==name
return count(*) as n
"""
Then the result should be, in any order, with relax comparison:
| n |
| 0 |
And the execution plan should be:
| id | name | dependencies | profiling data | operator info |
| 14 | Aggregate | 13 | | |
| 13 | Filter | 12 | | |
| 12 | CrossJoin | 6,11 | | |
| 6 | Project | 16 | | |
| 16 | AppendVertices | 2 | | |
| 2 | Dedup | 1 | | |
| 1 | PassThrough | 3 | | |
| 3 | Start | | | |
| 11 | Project | 18 | | |
| 18 | AppendVertices | 17 | | |
| 17 | Traverse | 8 | | |
| 8 | IndexScan | 7 | | |
| 7 | Argument | | | |
When executing query:
"""
match (v:player)
where id(v) == 'Yao Ming'
with v.player.name1 as name
match (v1:player)--(v2:player)
where v1.player.name IN name
return count(*) as n
"""
Then the result should be, in any order, with relax comparison:
| n |
| 0 |
When executing query:
"""
match (v:player)
where id(v) == 'A'
with v.player.name as name
match (v1:player)--(v2:player)
where v1.player.name IN name
return count(*) as n
"""
Then the result should be, in any order, with relax comparison:
| n |
| 0 |
When executing query:
"""
with NULL as vid
match (v:player)
where id(v)==vid
return count(*) as n
"""
Then the result should be, in any order, with relax comparison:
| n |
| 0 |
When executing query:
"""
with LIST[] as vid
match (v:player)
where id(v)==vid
return count(*) as n
"""
Then the result should be, in any order, with relax comparison:
| n |
| 0 |
When executing query:
"""
with NULL as vid
match (v:player)
where id(v) IN vid
return count(*) as n
"""
Then the result should be, in any order, with relax comparison:
| n |
| 0 |
When executing query:
"""
with LIST[] as vid
match (v:player)
where id(v) IN vid
return count(*) as n
"""
Then the result should be, in any order, with relax comparison:
| n |
| 0 |

0 comments on commit 70b4eb2

Please sign in to comment.