Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyu85cn committed Dec 23, 2021
1 parent 2e370d2 commit 7f533b5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 44 deletions.
6 changes: 3 additions & 3 deletions src/storage/exec/FilterNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class FilterNode : public IterateNode<T> {
}
switch (mode_) {
case FilterMode::TAG_AND_EDGE:
return checkTagOrEdge();
return checkTagAndEdge();
case FilterMode::TAG_ONLY:
return checkTagOnly();
default:
return checkTagOrEdge();
return checkTagAndEdge();
}
}

Expand All @@ -89,7 +89,7 @@ class FilterNode : public IterateNode<T> {
}

// 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_);
Expand Down
6 changes: 2 additions & 4 deletions src/storage/exec/GetNeighborsNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,12 @@ class GetNeighborsNode : public QueryNode<VertexID> {
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;
}

Expand Down
6 changes: 1 addition & 5 deletions src/storage/query/GetNeighborsProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, "
Expand Down Expand Up @@ -252,8 +251,6 @@ StoragePlan<VertexID> 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));
}
Expand Down Expand Up @@ -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) {
Expand Down
54 changes: 22 additions & 32 deletions src/storage/test/GetNeighborsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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<std::string>{"teamName", "startYear", "endYear"});
// edges.emplace_back(serve, std::vector<std::string>{"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
Expand Down Expand Up @@ -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";
Expand All @@ -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);
}
Expand All @@ -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";
Expand All @@ -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";
Expand All @@ -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";
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 7f533b5

Please sign in to comment.