From 4dacfccd3ff6b9c043808e8087445013363adf1e Mon Sep 17 00:00:00 2001 From: jimingquan Date: Tue, 15 Feb 2022 15:39:49 +0800 Subject: [PATCH] address comment --- src/graph/executor/algo/SubgraphExecutor.cpp | 5 +++-- src/graph/executor/query/DataCollectExecutor.cpp | 3 +++ src/graph/executor/query/GetNeighborsExecutor.cpp | 1 - tests/tck/features/subgraph/subgraph.feature | 3 --- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/graph/executor/algo/SubgraphExecutor.cpp b/src/graph/executor/algo/SubgraphExecutor.cpp index f8f9df1de68..2b83943c191 100644 --- a/src/graph/executor/algo/SubgraphExecutor.cpp +++ b/src/graph/executor/algo/SubgraphExecutor.cpp @@ -42,7 +42,8 @@ folly::Future SubgraphExecutor::execute() { auto& biDirectEdgeTypes = subgraph->biDirectEdgeTypes(); while (iter->valid()) { const auto& dst = iter->getEdgeProp("*", nebula::kDst); - if (historyVids_.find(dst) != historyVids_.end()) { + auto findIter = historyVids_.find(dst); + if (findIter != historyVids_.end()) { if (biDirectEdgeTypes.empty()) { iter->next(); } else { @@ -53,7 +54,7 @@ folly::Future SubgraphExecutor::execute() { } auto type = typeVal.getInt(); if (biDirectEdgeTypes.find(type) != biDirectEdgeTypes.end()) { - if (type < 0 || historyVids_[dst] + 2 == currentStep) { + if (type < 0 || findIter->second + 2 == currentStep) { iter->erase(); } else { iter->next(); diff --git a/src/graph/executor/query/DataCollectExecutor.cpp b/src/graph/executor/query/DataCollectExecutor.cpp index df4ad8c2140..83ef2f8f9c4 100644 --- a/src/graph/executor/query/DataCollectExecutor.cpp +++ b/src/graph/executor/query/DataCollectExecutor.cpp @@ -86,6 +86,9 @@ Status DataCollectExecutor::collectSubgraph(const std::vector& vars } edges.emplace_back(std::move(edge)); } + if (vertices.empty() && edges.empty()) { + break; + } ds.rows.emplace_back(Row({std::move(vertices), std::move(edges)})); } } diff --git a/src/graph/executor/query/GetNeighborsExecutor.cpp b/src/graph/executor/query/GetNeighborsExecutor.cpp index d7f5b5877cd..c315ce53910 100644 --- a/src/graph/executor/query/GetNeighborsExecutor.cpp +++ b/src/graph/executor/query/GetNeighborsExecutor.cpp @@ -105,7 +105,6 @@ Status GetNeighborsExecutor::handleResponse(RpcResponse& resps) { list.values.emplace_back(std::move(*dataset)); } - VLOG(1) << "GetNeightbors Result : " << list; builder.value(Value(std::move(list))).iter(Iterator::Kind::kGetNeighbors); return finish(builder.build()); } diff --git a/tests/tck/features/subgraph/subgraph.feature b/tests/tck/features/subgraph/subgraph.feature index 94f8f1718c0..724e5b4b4be 100644 --- a/tests/tck/features/subgraph/subgraph.feature +++ b/tests/tck/features/subgraph/subgraph.feature @@ -1,7 +1,6 @@ # Copyright (c) 2021 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. -@jmq Feature: subgraph Background: @@ -326,7 +325,6 @@ Feature: subgraph | <[vertex2]> | <[edge2]> | | <[vertex3]> | <[edge3]> | - @jmm Scenario: two steps in and out edge When executing query: """ @@ -1059,4 +1057,3 @@ Feature: subgraph Then the result should be, in any order, with relax comparison: | nodes | relationships | | [("Tom")] | [] | - | [] | [] |