diff --git a/src/context/Iterator.cpp b/src/context/Iterator.cpp index 344849276..03ec95953 100644 --- a/src/context/Iterator.cpp +++ b/src/context/Iterator.cpp @@ -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 != "*" && @@ -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); diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index d9a54015b..e8725df57 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -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: """ diff --git a/tests/tck/features/subgraph/subgraph.feature b/tests/tck/features/subgraph/subgraph.feature index d6ea716c7..759e9abee 100644 --- a/tests/tck/features/subgraph/subgraph.feature +++ b/tests/tck/features/subgraph/subgraph.feature @@ -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")] | [] | + | [] | [] |