Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

[cherry-pick #1308]fix GetNeighborsIter::getEdge crash when no edge schema in space #1313

Merged
merged 2 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/context/Iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ const Value& GetNeighborsIter::getEdgeProp(const std::string& edge,
if (!valid()) {
return Value::kNullValue;
}
if (noEdge_) {
return Value::kEmpty;
}

auto& currentEdge = currentEdgeName();
if (edge != "*" &&
Expand Down Expand Up @@ -388,6 +391,9 @@ Value GetNeighborsIter::getEdge() const {
if (!valid()) {
return Value::kNullValue;
}
if (noEdge_) {
return Value::kEmpty;
}

Edge edge;
auto edgeName = currentEdgeName().substr(1, std::string::npos);
Expand Down
22 changes: 22 additions & 0 deletions tests/tck/features/match/Base.feature
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,28 @@ Feature: Basic match
| p |
| <("LeBron James")-[:like@0]->("Ray Allen")-[:like@0]->("Rajon Rondo")> |

Scenario: Match a path in a space which doesn't have edge schema
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| replica_factor | 1 |
| vid_type | FIXED_STRING(20) |
And having executed:
"""
CREATE TAG IF NOT EXISTS person(name string);
"""
When try to execute query:
"""
INSERT VERTEX person VALUES "Tom":("Tom")
"""
Then the execution should be successful
When executing query:
"""
MATCH p=(v)-[e*1]->(v2) WHERE id(v) IN ["Tom"] RETURN p
"""
Then the result should be, in any order, with relax comparison:
| p |

Scenario: Unsupported combination of some cypher clauses
When executing query:
"""
Expand Down
24 changes: 24 additions & 0 deletions tests/tck/features/subgraph/subgraph.feature
Original file line number Diff line number Diff line change
Expand Up @@ -894,3 +894,27 @@ Feature: subgraph
| <[vertex3]> | <[edge3]> |
| <[vertex4]> | <[edge4]> |
| <[vertex5]> | [] |

Scenario: Get subgraph in a space which doesn't have edge schema
Given an empty graph
And create a space with following options:
| partition_num | 9 |
| replica_factor | 1 |
| vid_type | FIXED_STRING(20) |
And having executed:
"""
CREATE TAG IF NOT EXISTS person(name string);
"""
When try to execute query:
"""
INSERT VERTEX person VALUES "Tom":("Tom")
"""
Then the execution should be successful
When executing query:
"""
GET SUBGRAPH 1 STEPS FROM "Tom"
"""
Then the result should be, in any order, with relax comparison:
| _vertices | _edges |
| [("Tom")] | [] |
| [] | [] |