diff --git a/.gitignore b/.gitignore index 6a89523dcc4..4c30e576fa8 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ cmake-build*/ .cache/ core.* workspace.* +.metals/ #py *.egg-info diff --git a/src/graph/context/Iterator.cpp b/src/graph/context/Iterator.cpp index 53ae6025fd4..c491025a7f9 100644 --- a/src/graph/context/Iterator.cpp +++ b/src/graph/context/Iterator.cpp @@ -309,6 +309,10 @@ const Value& GetNeighborsIter::getEdgeProp(const std::string& edge, const std::s return Value::kNullValue; } + if (noEdge_) { + return Value::kEmpty; + } + auto& currentEdge = currentEdgeName(); if (edge != "*" && (currentEdge.compare(1, std::string::npos, edge) != 0)) { VLOG(1) << "Current edge: " << currentEdgeName() << " Wanted: " << edge; @@ -383,6 +387,10 @@ Value GetNeighborsIter::getEdge() const { return Value::kNullValue; } + if (noEdge_) { + return Value::kEmpty; + } + Edge edge; auto edgeName = currentEdgeName().substr(1, std::string::npos); edge.name = edgeName; diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 1a1ef8300ae..d8dfe4a255d 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -414,6 +414,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 d6ea716c7e1..759e9abee7a 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")] | [] | + | [] | [] |