From 7f533b55459ca5d89a58d7e7b31a23f21e99e055 Mon Sep 17 00:00:00 2001 From: liuyu <52276794+liuyu85cn@users.noreply.github.com> Date: Thu, 23 Dec 2021 12:42:24 +0800 Subject: [PATCH] fix comment --- src/storage/exec/FilterNode.h | 6 +-- src/storage/exec/GetNeighborsNode.h | 6 +-- src/storage/query/GetNeighborsProcessor.cpp | 6 +-- src/storage/test/GetNeighborsTest.cpp | 54 +++++++++------------ 4 files changed, 28 insertions(+), 44 deletions(-) diff --git a/src/storage/exec/FilterNode.h b/src/storage/exec/FilterNode.h index 276415cf78f..fe5c4ab82b3 100644 --- a/src/storage/exec/FilterNode.h +++ b/src/storage/exec/FilterNode.h @@ -73,11 +73,11 @@ class FilterNode : public IterateNode { } switch (mode_) { case FilterMode::TAG_AND_EDGE: - return checkTagOrEdge(); + return checkTagAndEdge(); case FilterMode::TAG_ONLY: return checkTagOnly(); default: - return checkTagOrEdge(); + return checkTagAndEdge(); } } @@ -89,7 +89,7 @@ class FilterNode : public IterateNode { } // return true when the value iter points to a value which can filter - bool checkTagOrEdge() { + bool checkTagAndEdge() { expCtx_->reset(this->reader(), this->key().str()); // result is false when filter out auto result = filterExp_->eval(*expCtx_); diff --git a/src/storage/exec/GetNeighborsNode.h b/src/storage/exec/GetNeighborsNode.h index dab40cd37af..5a5c17f9dab 100644 --- a/src/storage/exec/GetNeighborsNode.h +++ b/src/storage/exec/GetNeighborsNode.h @@ -82,14 +82,12 @@ class GetNeighborsNode : public QueryNode { row[1].setList(agg->mutableResult().moveList()); } + // only set filterInvalidResultOut = true in TagOnly mode + // so if it it an edge, this test is always true if (!context_->filterInvalidResultOut || context_->resultStat_ == ResultStatus::NORMAL) { resultDataSet_->rows.emplace_back(std::move(row)); } - // if (context_->resultStat_ == ResultStatus::NORMAL) { - - // } - return nebula::cpp2::ErrorCode::SUCCEEDED; } diff --git a/src/storage/query/GetNeighborsProcessor.cpp b/src/storage/query/GetNeighborsProcessor.cpp index c6b1bdac55e..27782c6a0c2 100644 --- a/src/storage/query/GetNeighborsProcessor.cpp +++ b/src/storage/query/GetNeighborsProcessor.cpp @@ -85,7 +85,6 @@ void GetNeighborsProcessor::runInSingleThread(const cpp2::GetNeighborsRequest& r for (const auto& row : partEntry.second) { CHECK_GE(row.values.size(), 1); auto vId = row.values[0].getStr(); - LOG(INFO) << "messi vid: " << vId; if (!NebulaKeyUtils::isValidVidLen(spaceVidLen_, vId)) { LOG(ERROR) << "Space " << spaceId_ << ", vertex length invalid, " @@ -252,8 +251,6 @@ StoragePlan GetNeighborsProcessor::buildPlan(RuntimeContext* context, upstream = filter.get(); if (edges.empty()) { filter.get()->setFilterMode(FilterMode::TAG_ONLY); - } else { - LOG(INFO) << "messi edges.size() = " << edges.size(); } plan.addNode(std::move(filter)); } @@ -323,8 +320,7 @@ nebula::cpp2::ErrorCode GetNeighborsProcessor::buildTagContext(const cpp2::Trave // If the list is not given, no prop will be returned. return nebula::cpp2::ErrorCode::SUCCEEDED; } - auto returnProps = - (*req.vertex_props_ref()).empty() ? buildAllTagProps() : *req.vertex_props_ref(); + auto returnProps = *req.vertex_props_ref(); auto ret = handleVertexProps(returnProps); if (ret != nebula::cpp2::ErrorCode::SUCCEEDED) { diff --git a/src/storage/test/GetNeighborsTest.cpp b/src/storage/test/GetNeighborsTest.cpp index 428f758e3a5..7caa72ae8c3 100644 --- a/src/storage/test/GetNeighborsTest.cpp +++ b/src/storage/test/GetNeighborsTest.cpp @@ -1020,9 +1020,8 @@ TEST(GetNeighborsTest, TtlTest) { auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, - teammate, - serve, + serve, + - // teammate, expr - size_t expectColsNum = 6; + // vId, stat, expr + size_t expectColsNum = 3; QueryTestUtils::checkResponse( *resp.vertices_ref(), vertices, over, tags, edges, 1, expectColsNum); } @@ -1061,29 +1060,25 @@ TEST(GetNeighborsTest, TtlTest) { auto req = QueryTestUtils::buildRequest(totalParts, vertices, over, tags, edges); (*req.traverse_spec_ref()).set_edge_direction(cpp2::EdgeDirection::BOTH); - // edges.emplace_back(teammate, std::vector{"teamName", "startYear", "endYear"}); - // edges.emplace_back(serve, std::vector{"teamName", "startYear", "endYear"}); - auto* processor = GetNeighborsProcessor::instance(env, nullptr, threadPool.get()); auto fut = processor->getFuture(); processor->process(req); auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, - teammate, - serve, + serve, + - // teammate, expr + // vId, stat, expr ASSERT_EQ(1, (*resp.vertices_ref()).rows.size()); - ASSERT_EQ(6, (*resp.vertices_ref()).rows[0].values.size()); + ASSERT_EQ(3, (*resp.vertices_ref()).rows[0].values.size()); for (auto& s : resp.vertices_ref().value().colNames) { LOG(INFO) << "colName: " << s; } ASSERT_EQ("Tim Duncan", (*resp.vertices_ref()).rows[0].values[0].getStr()); ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[1].empty()); // stat - ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[2].empty()); // player expired - ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[3].empty()); // team not exists - ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[4].empty()); // general tag not exists + ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[2].empty()); // expr player expired + // ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[3].empty()); // team not exists + // ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[4].empty()); // general tag not exists // ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[5].isList()); // - teammate valid - ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[5].empty()); // - serve expired + // ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[5].empty()); // - serve expired // ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[7].empty()); // + serve expired // ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[8].isList()); // + teammate valid // ASSERT_TRUE((*resp.vertices_ref()).rows[0].values[9].empty()); // expr @@ -1280,9 +1275,8 @@ TEST(GetNeighborsTest, GoOverAllTest) { auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, - teammate, - serve, + serve, + - // teammate, expr - QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 1, 6); + // vId, stat, expr + QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 1, 3); } { LOG(INFO) << "GoFromTeamOverAll"; @@ -1299,9 +1293,8 @@ TEST(GetNeighborsTest, GoOverAllTest) { auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, - teammate, - serve, + serve, + - // teammate, expr - size_t expectColCnt = 6; + // vId, stat, expr + size_t expectColCnt = 3; QueryTestUtils::checkResponse( *resp.vertices_ref(), vertices, over, tags, edges, 1, expectColCnt); } @@ -1320,8 +1313,8 @@ TEST(GetNeighborsTest, GoOverAllTest) { auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, - serve, - teammate, expr - QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 1, 6); + // vId, stat, expr + QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 1, 3); } { LOG(INFO) << "GoFromPlayerOverOutEdge"; @@ -1338,8 +1331,8 @@ TEST(GetNeighborsTest, GoOverAllTest) { auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, + serve, + teammate, expr - QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 1, 6); + // vId, stat, expr + QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 1, 3); } { LOG(INFO) << "GoFromMultiPlayerOverAll"; @@ -1356,9 +1349,8 @@ TEST(GetNeighborsTest, GoOverAllTest) { auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, - teammate, - serve, + serve, + - // teammate, expr - QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 3, 6); + // vId, stat, _expr + QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 3, 3); } { LOG(INFO) << "GoFromMultiTeamOverAll"; @@ -1375,9 +1367,8 @@ TEST(GetNeighborsTest, GoOverAllTest) { auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, - teammate, - serve, + serve, + - // teammate, expr - QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 3, 6); + // vId, stat, _expr + QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 3, 3); } } @@ -1406,9 +1397,8 @@ TEST(GetNeighborsTest, MultiVersionTest) { auto resp = std::move(fut).get(); ASSERT_EQ(0, (*resp.result_ref()).failed_parts.size()); - // vId, stat, player, team, general tag, - teammate, - serve, + serve, + - // teammate, expr - QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 1, 6); + // vId, stat, player, team + QueryTestUtils::checkResponse(*resp.vertices_ref(), vertices, over, tags, edges, 1, 3); } }